Added a horrible hacky way of doing cmd-k correctly.

This commit is contained in:
Mikayla Maki 2022-10-07 12:04:26 -07:00
parent bf50a8ad8e
commit 15595a67fa

View file

@ -618,11 +618,34 @@ impl Terminal {
term.resize(new_size);
}
InternalEvent::Clear => {
// Clear back buffer
term.clear_screen(ClearMode::Saved);
term.clear_screen(ClearMode::All);
let cursor = term.grid().cursor.point;
term.grid_mut().cursor.point = Point::new(Line(0), Column(0));
// Clear the lines above
term.grid_mut().reset_region(..cursor.line);
// Copy the current line up
let line = term.grid()[cursor.line][..cursor.column]
.iter()
.cloned()
.enumerate()
.collect::<Vec<(usize, Cell)>>();
for (i, cell) in line {
term.grid_mut()[Line(0)][Column(i)] = cell;
}
// Reset the cursor
term.grid_mut().cursor.point =
Point::new(Line(0), term.grid_mut().cursor.point.column);
let new_cursor = term.grid().cursor.point;
// Clear the lines below the new cursor
if (new_cursor.line.0 as usize) < term.screen_lines() - 1 {
term.grid_mut().reset_region((new_cursor.line + 1)..);
}
}
InternalEvent::Scroll(scroll) => {
term.scroll_display(*scroll);