From 9d1a3e5b44cef878f6abecdf76481491aac9eba9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Oct 2024 13:05:31 +0530 Subject: [PATCH] Fix resizing window when alternate screen is active does not preserve trailing blank output line in the main screen Fixes #7978 --- docs/changelog.rst | 2 ++ kitty/screen.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 829feef11..e86e798e9 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/screen.c b/kitty/screen.c index cc93d795e..18b143237 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -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