Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
nnh12 authored Dec 6, 2024
1 parent e7d127f commit f21345c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions applications/shell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ enum AppErr {
SpawnErr(String)
}

/// This bundles start and end index char into one structure
struct LineSlice {
// The starting index in the String for a line. (inclusive)
start: usize,
Expand Down Expand Up @@ -177,11 +178,11 @@ pub struct Shell {
terminal: Arc<Mutex<Terminal>>,
/// The indicator to show "text editing" mode
less: bool,
// string to print
// String to store file
content: String,
// BTree Map to keep track of file new line indices
map: BTreeMap<usize, LineSlice>,
// Line
// Line to start the display
line_start: usize
}

Expand Down Expand Up @@ -1500,10 +1501,6 @@ impl Shell {
previous_char = c;
}
self.map.insert(cur_line_num, LineSlice{ start: line_start_idx, end: self.content.len() });

for (line_num, line_slice) in &self.map {
info!("Line {}: start = {}, end = {}\n", line_num, line_slice.start, line_slice.end);
}
}

/// Stores the entire file as a string to be parsed by 'less' operation
Expand Down Expand Up @@ -1542,7 +1539,6 @@ impl Shell {
return Err(format!("Failed to read file: {:?}", utf8_err));
}
};
//self.terminal.lock().print_to_terminal(read_string.to_string());
self.content = read_string.to_string();
Ok(read_string.to_string())
}
Expand Down

0 comments on commit f21345c

Please sign in to comment.