fix: fix Terminal scrolling issue at zoom
This commit is contained in:
@@ -12,4 +12,4 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define MONTAUK_BUILD_NUMBER 106
|
#define MONTAUK_BUILD_NUMBER 107
|
||||||
|
|||||||
@@ -232,9 +232,15 @@ static bool term_render_into(uint32_t* pixels, int width, int height) {
|
|||||||
|
|
||||||
TerminalState* ts = g_tabs.tabs[g_tabs.active_tab];
|
TerminalState* ts = g_tabs.tabs[g_tabs.active_tab];
|
||||||
|
|
||||||
// Only resize the terminal buffer when surface pixel dimensions change,
|
// Resize the cell grid when the visible cell layout changes: either the
|
||||||
// not when font size (zoom) changes
|
// surface pixel dimensions changed, or a zoom (font size) change altered
|
||||||
if (width != g_last_win_w || term_h != g_last_win_h) {
|
// how many whole cells now fit. Skipping the zoom case leaves the grid at
|
||||||
|
// its old row count, so at a larger font fewer rows fit on screen and the
|
||||||
|
// bottom rows (cursor and prompt included) scroll off below the viewport;
|
||||||
|
// resizing reflows the overflow into scrollback and keeps the cursor in
|
||||||
|
// view. terminal_resize is a no-op per tab whose dimensions already match.
|
||||||
|
if (width != g_last_win_w || term_h != g_last_win_h ||
|
||||||
|
new_cols != ts->cols || new_rows != ts->rows) {
|
||||||
g_last_win_w = width;
|
g_last_win_w = width;
|
||||||
g_last_win_h = term_h;
|
g_last_win_h = term_h;
|
||||||
for (int i = 0; i < g_tabs.tab_count; i++)
|
for (int i = 0; i < g_tabs.tab_count; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user