Skip to content

Commit 7a60c79

Browse files
committed
Merge tag 'tty-7.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty fixes from Greg KH: "Here are two small tty vt fixes for 7.0-rc7 to resolve some reported issues with the resize ability of the alt screen buffer. Both of these have been in linux-next all week with no reported issues" * tag 'tty-7.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: vt: resize saved unicode buffer on alt screen exit after resize vt: discard stale unicode buffer on alt screen exit after resize
2 parents aea7c84 + 3ddbea7 commit 7a60c79

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

drivers/tty/vt/vt.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,6 +1909,24 @@ static void leave_alt_screen(struct vc_data *vc)
19091909
dest = ((u16 *)vc->vc_origin) + r * vc->vc_cols;
19101910
memcpy(dest, src, 2 * cols);
19111911
}
1912+
/*
1913+
* If the console was resized while in the alternate screen,
1914+
* resize the saved unicode buffer to the current dimensions.
1915+
* On allocation failure new_uniscr is NULL, causing the old
1916+
* buffer to be freed and vc_uni_lines to be lazily rebuilt
1917+
* via vc_uniscr_check() when next needed.
1918+
*/
1919+
if (vc->vc_saved_uni_lines &&
1920+
(vc->vc_saved_rows != vc->vc_rows ||
1921+
vc->vc_saved_cols != vc->vc_cols)) {
1922+
u32 **new_uniscr = vc_uniscr_alloc(vc->vc_cols, vc->vc_rows);
1923+
1924+
if (new_uniscr)
1925+
vc_uniscr_copy_area(new_uniscr, vc->vc_cols, vc->vc_rows,
1926+
vc->vc_saved_uni_lines, cols, 0, rows);
1927+
vc_uniscr_free(vc->vc_saved_uni_lines);
1928+
vc->vc_saved_uni_lines = new_uniscr;
1929+
}
19121930
vc_uniscr_set(vc, vc->vc_saved_uni_lines);
19131931
vc->vc_saved_uni_lines = NULL;
19141932
restore_cur(vc);

0 commit comments

Comments
 (0)