diff --git a/docs/changelog.md b/docs/changelog.md index 4de13d634..07cea2566 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -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 diff --git a/term/src/terminalstate/mod.rs b/term/src/terminalstate/mod.rs index a6a56921a..d7a1fab2c 100644 --- a/term/src/terminalstate/mod.rs +++ b/term/src/terminalstate/mod.rs @@ -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. + // + EraseInLine::EraseToEndOfLine => cx + if self.wrap_next { 1 } else { 0 }..cols, EraseInLine::EraseToStartOfLine => 0..cx + 1, EraseInLine::EraseLine => 0..cols, };