1
1
mirror of https://github.com/wez/wezterm.git synced 2024-08-16 09:40:34 +03:00

rudimentary attempt at fixing line wrap, part 2

This feels more like a workaround.
I would expect, that when a program prints exactly
as many chars as there a columns, the cursor would wrap
into the next line. This would be possible by putting
another "if self.wrap_next {" block after the for loop
in the performer. But it seems like there are programs
that depend on it not doing that, e.g. fish shell.
It prints a full line of mostly spaces and then does \r,
expecting the cursor is still on the same line.

This way, the cursor overflows into an extra column,
but I'm sure this has its own disadvantages. Perhaps
this commit should not be used at all.
This commit is contained in:
Funami580 2024-02-28 16:29:30 +01:00
parent 8b7c004e94
commit ed58024357
2 changed files with 9 additions and 2 deletions

View File

@ -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,
)

View File

@ -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;