really fix the erase in display issue
We also need an implicit erase in line in the appropriate direction
This commit is contained in:
1 parent
fd148f33e9
commit
5482323be5
3 files changed
+14
-6
No files matched your search
@@ -1169,8 +1169,14 @@ impl TerminalState {
|
||||
let rows = self.screen().physical_rows as VisibleRowIndex;
|
||||
let col_range = 0..usize::max_value();
|
||||
let row_range = match erase {
|
||||
EraseInDisplay::EraseToEndOfDisplay => cy + 1..rows,
|
||||
EraseInDisplay::EraseToStartOfDisplay => 0..cy,
|
||||
EraseInDisplay::EraseToEndOfDisplay => {
|
||||
self.perform_csi_edit(Edit::EraseInLine(EraseInLine::EraseToEndOfLine));
|
||||
cy + 1..rows
|
||||
}
|
||||
EraseInDisplay::EraseToStartOfDisplay => {
|
||||
self.perform_csi_edit(Edit::EraseInLine(EraseInLine::EraseToStartOfLine));
|
||||
0..cy
|
||||
}
|
||||
EraseInDisplay::EraseDisplay => 0..rows,
|
||||
EraseInDisplay::EraseScrollback => {
|
||||
eprintln!("TODO: ed: no support for xterm Erase Saved Lines yet");
|
||||
|
||||
@@ -136,9 +136,9 @@ fn test_cha() {
|
||||
fn test_ed() {
|
||||
let mut term = TestTerm::new(3, 3, 0);
|
||||
term.print("abc\ndef\nghi");
|
||||
term.cup(0, 1);
|
||||
term.cup(1, 2);
|
||||
term.print("\x1b[J");
|
||||
assert_visible_contents(&term, &["abc", "def", " "]);
|
||||
assert_visible_contents(&term, &["abc", "def", "g "]);
|
||||
|
||||
// Set background color to blue
|
||||
term.print("\x1b[44m");
|
||||
|
||||
@@ -345,12 +345,14 @@ fn basic_output() {
|
||||
&[
|
||||
" ",
|
||||
" ",
|
||||
"rld! ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
],
|
||||
);
|
||||
|
||||
term.cup(0, 2);
|
||||
term.print("woot");
|
||||
term.cup(2, 2);
|
||||
term.erase_in_line(EraseInLine::EraseToEndOfLine);
|
||||
assert_visible_contents(
|
||||
@@ -358,7 +360,7 @@ fn basic_output() {
|
||||
&[
|
||||
" ",
|
||||
" ",
|
||||
"rl ",
|
||||
"wo ",
|
||||
" ",
|
||||
" ",
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user