Fix ClearToEndOfLine in last column when wrap_next=true

Given a sequence like this, where the `ESC [ K` sequence is
emitted at the last column when wrap_next=true:

\u001b[47;30m  17:24:50 \u001b[0m\u001b[K

rather than treating the column as out of bounds, we'd clear the
final cell.

refs: #3548
This commit is contained in:
Wez Furlong committed 2023-05-29 16:01:11 -07:00
1 parent c1147720bc
commit c54548df7e
2 files changed
+10 -1

No files matched your search

+3
View File
@@ -98,6 +98,9 @@ As features stabilize some brief notes about them will accumulate here.
overwritten due to a conpty issue. #3531
* Changing the color palette back to the default without resetting the terminal
would prevent changes to `color_scheme` from taking effect. #3685
* ClearToEndOfLine performed in the last column of the display, when it is
prepped to wrap to the next line, would incorrectly clear the last cell.
#3548
#### Updated
* Bundled harfbuzz to 7.1.0
+7 -1
View File
@@ -2125,7 +2125,13 @@ impl TerminalState {
let cols = self.screen().physical_cols;
let bidi_mode = self.get_bidi_mode();
let range = match erase {
EraseInLine::EraseToEndOfLine => cx..cols,
// If wrap_next is true, then cx is effectively 1 column to the right.
// It feels wrong to handle this here, but in trying to centralize
// the logic for updating the cursor position, it causes regressions
// in the test suite.
// So this is here for now until a better solution is found.
// <https://github.com/wez/wezterm/issues/3548>
EraseInLine::EraseToEndOfLine => cx + if self.wrap_next { 1 } else { 0 }..cols,
EraseInLine::EraseToStartOfLine => 0..cx + 1,
EraseInLine::EraseLine => 0..cols,
};