From 1fc5f4afd1b554b498f470749237d4fea7a9a405 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 15 Dec 2024 14:48:01 +0000 Subject: [PATCH] wm_size_resize_term: update conf unconditionally. A user reported that when a PuTTY window is resized by the 'FancyZones' tool included in Microsoft PowerToys, the terminal itself knows the new size ('stty' showed that it had sent a correct SIGWINCH to the SSH server), but the next invocation of the Change Settings dialog box still has the old size entered in it, leading to confusing behaviour when you press Apply. Inside PuTTY, this must mean that we updated the actual terminal's size, but didn't update the main Conf object to match it, which is where Change Settings populates its initial dialog state from. It looks as if this is because FancyZones resizes the window by sending it one single WM_SIZE, without wrapping it in the WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE messages that signal the start and end of an interactive dragging resize operation. And the update of Conf in wm_size_resize_term was in only one branch of the if statement that checks whether we're in an interactive resize. Now it's outside the if, so Conf will be updated in both cases. --- windows/window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/window.c b/windows/window.c index e580f653..b2ac0adb 100644 --- a/windows/window.c +++ b/windows/window.c @@ -2185,12 +2185,12 @@ static void wm_size_resize_term(WinGuiSeat *wgs, LPARAM lParam) * numbers of resize events. */ wgs->need_backend_resize = true; - conf_set_int(wgs->conf, CONF_height, h); - conf_set_int(wgs->conf, CONF_width, w); } else { term_size(wgs->term, h, w, conf_get_int(wgs->conf, CONF_savelines)); } + conf_set_int(wgs->conf, CONF_height, h); + conf_set_int(wgs->conf, CONF_width, w); } static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,