Fix handling of tab character when cursor is at end of line and wrapping is enabled

Fixes #7250
This commit is contained in:
Kovid Goyal 2024-03-23 08:43:06 +05:30
parent af82938427
commit a0aba4da4a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 17 additions and 1 deletions

View File

@ -62,6 +62,8 @@ Detailed list of changes
- macOS: Fix a regression in the previous release that broke rendering of some symbols on some systems (:iss:`7249`)
- Fix handling of tab character when cursor is at end of line and wrapping is enabled (:iss:`7250`)
0.33.1 [2024-03-21]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -730,7 +730,18 @@ draw_text_loop(Screen *self, const uint32_t *chars, size_t num_chars, text_loop_
case BS:
screen_backspace(self); break;
case HT:
screen_tab(self); break;
if (UNLIKELY(self->cursor->x >= self->columns)) {
if (self->modes.mDECAWM) {
// xterm discards the TAB in this case so match its behavior
continue_to_next_line(self);
init_text_loop_line(self, s);
} else if (self->columns > 0){
self->cursor->x = self->columns - 1;
if (cursor_on_wide_char_trailer(self, s)) move_cursor_off_wide_char_trailer(self, s);
screen_tab(self);
}
} else screen_tab(self);
break;
case SI:
screen_change_charset(self, 0); break;
case SO:

View File

@ -419,6 +419,9 @@ def test_tab_stops(self):
s.draw('*')
s.cursor_position(2, 2)
self.ae(str(s.line(0)), '\t*'*13)
s = self.create_screen(cols=4, lines=2)
s.draw('aaaX\tbbbb')
self.ae(str(s.line(0)) + str(s.line(1)), 'aaaXbbbb')
def test_margins(self):
# Taken from vttest/main.c