1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-25 14:05:41 -05:00

Preserve last column with erase in line right

When the erase in line escape sequence with a parameter of 0 (right) is
passed while the wrapline flag is already set, it will no longer clear
the last column and instead ignore the operation.

The behavior of `\e[1K` and `\e[2K` is unchanged and both will clear the
entire first line without clearing the wrapline flag.

Closes #6159.
This commit is contained in:
Christian Duerr 2023-01-15 22:53:41 +00:00 committed by GitHub
parent bcd6d0d981
commit 5a3280e8e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 0 deletions

View file

@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `font.glyph_offset.y` is now applied to underline/strikeout - `font.glyph_offset.y` is now applied to underline/strikeout
- Always use sRGB color space on macOS - Always use sRGB color space on macOS
- Erase in line after the last column will no longer clear the last column
### Fixed ### Fixed

View file

@ -1458,6 +1458,7 @@ impl<T: EventListener> Handler for Term<T> {
let point = cursor.point; let point = cursor.point;
let (left, right) = match mode { let (left, right) = match mode {
ansi::LineClearMode::Right if cursor.input_needs_wrap => return,
ansi::LineClearMode::Right => (point.column, Column(self.columns())), ansi::LineClearMode::Right => (point.column, Column(self.columns())),
ansi::LineClearMode::Left => (Column(0), point.column + 1), ansi::LineClearMode::Left => (Column(0), point.column + 1),
ansi::LineClearMode::All => (Column(0), Column(self.columns())), ansi::LineClearMode::All => (Column(0), Column(self.columns())),

View file

@ -70,6 +70,7 @@ ref_tests! {
wrapline_alt_toggle wrapline_alt_toggle
zerowidth zerowidth
zsh_tab_completion zsh_tab_completion
erase_in_line
} }
fn read_u8<P>(path: P) -> Vec<u8> fn read_u8<P>(path: P) -> Vec<u8>

View file

@ -0,0 +1,8 @@
[?2004h[undeadleech@archhq erase_in_line]$ s=$(echo {1..100}); echo ${s:0:$(($COLUMNS-2))}a$'+\e[0Kb' s=$(echo {1..100}); echo ${s:0:$(($COLUMNS-2))}a$'+\e[0Kb'
[?2004l 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49a+b
[?2004h[undeadleech@archhq erase_in_line]$ s=$(echo {1..100}); echo ${s:0:$(($COLUMNS-2))}a$'+\e[1Kb' s=$(echo {1..100}); echo ${s:0:$(($COLUMNS-2))}a$'+\e[1Kb'
[?2004l 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49a+b
[?2004h[undeadleech@archhq erase_in_line]$ s=$(echo {1..100}); echo ${s:0:$(($COLUMNS-2))}a$'+\e[2Kb' s=$(echo {1..100}); echo ${s:0:$(($COLUMNS-2))}a$'+\e[2Kb'
[?2004l 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49a+b
[?2004h[undeadleech@archhq erase_in_line]$ [?2004l
exit

View file

@ -0,0 +1 @@
{"history_size":0}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"columns":139,"screen_lines":33}