mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-24 17:28:40 +00:00
Added a horrible hacky way of doing cmd-k correctly.
This commit is contained in:
parent
bf50a8ad8e
commit
15595a67fa
1 changed files with 25 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue