Terminal: ConPTY sends two `WINDOW_BUFFER_SIZE_EVENT` messages when the window is restored from maximize

Created on 1 Jul 2019  路  1Comment  路  Source: microsoft/terminal

I think I found one resize bug. A ConPTY sends two WINDOW_BUFFER_SIZE_EVENT messages when the window is restored from maximize, but the first one has the wrong size (not sure of the internals of this, but it appears in conhost/tmux/pwsh, alacritty/pwsh, and Windows Terminal).

Run this program as conevents -es in conhost and a different terminal to see the difference; maximize and restore the window. For example, restoring the WinTerm window reports 119 x 46 in the WINDOW_BUFFER_SIZE_EVENT message, but GetConsoleScreenBufferInfo returns the correct value 119 x 32.

_Originally posted by @parkovski in https://github.com/microsoft/terminal/issues/1465#issuecomment-506924361_

Area-Server Issue-Bug Priority-3 Product-Conpty v1-Scrubbed

Most helpful comment

Holy crap, I saw the cause of this in https://github.com/microsoft/terminal/issues/1795#issuecomment-516014782.

We perform a resize on the conpty buffer twice, once to resize the width, and again to resize the height. By resizing _twice_, we hit the code path that emits a WINDOW_BUFFER_SIZE_EVENT twice. This is obviously insane, so there's gotta be a better way.

>All comments

Holy crap, I saw the cause of this in https://github.com/microsoft/terminal/issues/1795#issuecomment-516014782.

We perform a resize on the conpty buffer twice, once to resize the width, and again to resize the height. By resizing _twice_, we hit the code path that emits a WINDOW_BUFFER_SIZE_EVENT twice. This is obviously insane, so there's gotta be a better way.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amithegde picture amithegde  路  114Comments

Byloth picture Byloth  路  56Comments

Paul-Weisser picture Paul-Weisser  路  71Comments

NOFUNEVER picture NOFUNEVER  路  106Comments

DHowett-MSFT picture DHowett-MSFT  路  285Comments