diff --git a/term/src/terminalstate/mod.rs b/term/src/terminalstate/mod.rs index 00c1357e6..ada148039 100644 --- a/term/src/terminalstate/mod.rs +++ b/term/src/terminalstate/mod.rs @@ -1001,7 +1001,11 @@ impl TerminalState { if self.dec_origin_mode { self.left_and_right_margins.end } else { - self.screen().physical_cols + // We allow 1 extra for the cursor x position + // to account for some resize/rewrap scenarios + // where we don't want to forget that the + // cursor belongs to a wrapped line + self.screen().physical_cols + 1 } as i64 - 1, ) diff --git a/term/src/terminalstate/performer.rs b/term/src/terminalstate/performer.rs index 6804c9d3f..9d8805bda 100644 --- a/term/src/terminalstate/performer.rs +++ b/term/src/terminalstate/performer.rs @@ -208,8 +208,11 @@ impl<'a> Performer<'a> { self.screen_mut() .set_cell_grapheme(x, y, g, print_width, attr_edited, seqno); - if !wrappable { + if !wrappable || self.cursor.x + print_width == width { self.cursor.x += print_width; + } + + if !wrappable { self.wrap_next = false; } else { self.wrap_next = self.dec_auto_wrap;