Slight refactor

This commit is contained in:
Greg Shuflin committed 2024-04-03 13:39:59 -07:00
1 parent 3b479f3de7
commit f8b3e2e41c
1 file changed
+7 -8
+7 -8
View File
@@ -125,7 +125,7 @@ impl TerminalState {
let expand_tab = active_buffer.buffer_settings.expand_tab;
// TODO do this more efficiently
let start = 0 as usize;
let start = 0_usize;
let end = start + (terminal_buf_height as usize);
let raw_lines = active_buffer.visible_lines(start, end);
let len = raw_lines.len();
@@ -133,7 +133,7 @@ impl TerminalState {
let mut text = vec![];
for (n, line) in raw_lines.into_iter().enumerate() {
let line_number = Span::styled(format!("{} ", n + 1), line_number_style);
match active_buffer.cursor() {
let line = match active_buffer.cursor() {
Some(cursor) if n == cursor.y() as usize => {
let x = cursor.x() as usize;
let screen_x = if x >= line.len() { line.len() } else { x };
@@ -146,17 +146,16 @@ impl TerminalState {
let rendered_precursor = process_line(precursor, expand_tab);
let rendered_postcursor = process_line(postcursor, expand_tab);
text.push(Line::from(vec![
Line::from(vec![
line_number,
rendered_precursor.into(),
cursor,
rendered_postcursor.to_owned().into(),
]));
])
}
_ => {
text.push(Line::from(vec![line_number, line.into()]));
}
}
_ => Line::from(vec![line_number, line.into()]),
};
text.push(line);
}
if terminal_buf_height as usize > len {