Defer initial terminal sizing until terminal initialization #4444

Open
opened 2026-01-30 23:47:55 +00:00 by claunia · 1 comment
Owner

Originally created by @mcpiroman on GitHub (Oct 13, 2019).

Right now the initial window size is calculated just as the window is created but before the terminal is. This has two disadvantages:

  1. It doesn't have all the size information. Right now its only the width of a scrollbar that it has to guess but there could be more (potentially variable size) elements in the future. There might also be some additional spacing in layers above, like pane or terminal page.
  2. It creates temporary DxRenderer just to locate required fond and calculate its size and then discards it.

If we instead calculated the initial size when terminal initializes this problems would be gone (it would be able to query sizes of the controls and use the real renderer of a terminal). We might potentially resolve them otherwise but this seems to be the simplest and most robust approach.

The problem is that it could result in two sizing operations (one when window opens and another one when the size is calculated) which could be noticeable to user or CPU, unless this can be somehow avoided. Thus I'm here to ask what do you think about this approach.

Originally created by @mcpiroman on GitHub (Oct 13, 2019). Right now the initial window size is calculated just as the window is created but before the terminal is. This has two disadvantages: 1. It doesn't have all the size information. Right now its only the width of a scrollbar that it has to guess but there could be more (potentially variable size) elements in the future. There might also be some additional spacing in layers above, like pane or terminal page. 2. It creates temporary `DxRenderer` just to locate required fond and calculate its size and then discards it. If we instead calculated the initial size when terminal initializes this problems would be gone (it would be able to query sizes of the controls and use the real renderer of a terminal). We might potentially resolve them otherwise but this seems to be the simplest and most robust approach. The problem is that it could result in two sizing operations (one when window opens and another one when the size is calculated) which could be noticeable to user or CPU, unless this can be somehow avoided. Thus I'm here to ask what do you think about this approach.
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 14, 2019):

you're not wrong. 😄

@DHowett-MSFT commented on GitHub (Oct 14, 2019): _you're not wrong_. :smile:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4444