Fix resizing window when alternate screen is active does not preserve trailing blank output line in the main screen

Fixes #7978
This commit is contained in:
Kovid Goyal 2024-10-19 13:05:31 +05:30
parent ccb5bfd372
commit 9d1a3e5b44
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 0 deletions

View file

@ -87,6 +87,8 @@ Detailed list of changes
- :opt:`tab_title_template` allow using the 256 terminal colors for formatting (:disc:`7976`)
- Fix resizing window when alternate screen is active does not preserve trailing blank output line in the main screen (:iss:`7978`)
0.36.4 [2024-09-27]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -373,6 +373,7 @@ screen_resize(Screen *self, unsigned int lines, unsigned int columns) {
index_type num_content_lines_before, num_content_lines_after;
bool dummy_output_inserted = false;
if (is_main) dummy_output_inserted = preserve_blank_output_start_line(self->cursor, self->linebuf);
else if (self->main_savepoint.is_valid) dummy_output_inserted = preserve_blank_output_start_line(&self->main_savepoint.cursor, self->main_linebuf);
unsigned int lines_after_cursor_before_resize = self->lines - self->cursor->y;
CursorTrack cursor = {.before = {self->cursor->x, self->cursor->y}};
CursorTrack main_saved_cursor = {.before = {self->main_savepoint.cursor.x, self->main_savepoint.cursor.y}};
@ -452,6 +453,7 @@ screen_resize(Screen *self, unsigned int lines, unsigned int columns) {
}
if (dummy_output_inserted) {
if (is_main) remove_blank_output_line_reservation_marker(self->cursor, self->linebuf);
else remove_blank_output_line_reservation_marker(&self->main_savepoint.cursor, self->main_linebuf);
}
if (num_of_prompt_lines) {
// Copy the old prompt lines without any reflow this prevents