Terminal size reporting issue #10295

Closed
opened 2026-01-31 02:17:34 +00:00 by claunia · 8 comments
Owner

Originally created by @Krmloo on GitHub (Aug 26, 2020).

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.450]
Windows Terminal version (if applicable): 1.1.2233.0
Windows scale: 200%
Tmux version: 2.6
Byobu version: 5.125
Font: MesloLGM NF

Issue has appeared right after updating to 2004 and updating WSL to v2.

Steps to reproduce

  1. Launch terminal
  2. Launch WSL2 distro
  3. Observe broken size reporting and incorrect line length
    image
  4. Resize the window few pixels out
  5. Observe correct line length
    image

Expected behaviour

Correct size reporting.

Actual behaviour

Incorrect size reporting.

Originally created by @Krmloo on GitHub (Aug 26, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Environment ``` Windows build number: Microsoft Windows [Version 10.0.19041.450] Windows Terminal version (if applicable): 1.1.2233.0 Windows scale: 200% Tmux version: 2.6 Byobu version: 5.125 Font: MesloLGM NF Issue has appeared right after updating to 2004 and updating WSL to v2. ``` # Steps to reproduce 1. Launch terminal 2. Launch WSL2 distro 3. Observe broken size reporting and incorrect line length ![image](https://user-images.githubusercontent.com/20140826/91245653-a8000a00-e756-11ea-964d-855130accc16.png) 4. Resize the window few pixels out 5. Observe correct line length ![image](https://user-images.githubusercontent.com/20140826/91245672-b3533580-e756-11ea-8e53-997a93ea95cd.png) # Expected behaviour Correct size reporting. # Actual behaviour Incorrect size reporting.
claunia added the Needs-TriageNeeds-Tag-FixNeeds-Attention labels 2026-01-31 02:17:34 +00:00
Author
Owner

@DHowett commented on GitHub (Aug 26, 2020):

Can you share the output of stty -a before and after you run tmux?
What shell are you using?
What's your tmux config look like? How about your shell profile?

It looks like something is attempting to force the window size.

@DHowett commented on GitHub (Aug 26, 2020): Can you share the output of `stty -a` before and after you run tmux? What shell are you using? What's your tmux config look like? How about your shell profile? It looks like something is attempting to force the window size.
Author
Owner

@Krmloo commented on GitHub (Aug 26, 2020):

Just checked - issue is not present if I don't autostart byobu (tmux) on login.
Launching it manually also doesn't make it break.
See further messages.

Without autostart:

speed 38400 baud; rows 30; columns 120; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

With autostart:

speed 38400 baud; rows 26; columns 114; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
@Krmloo commented on GitHub (Aug 26, 2020): ~~Just checked - issue is not present if I don't autostart byobu (tmux) on login. Launching it manually also doesn't make it break.~~ See further messages. Without autostart: ``` speed 38400 baud; rows 30; columns 120; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc ``` With autostart: ``` speed 38400 baud; rows 26; columns 114; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff -iuclc -ixany -imaxbel iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc ```
Author
Owner

@Krmloo commented on GitHub (Aug 26, 2020):

Additional info:
I'm running fish shell, theme is bobthefish.
Tmux config is the default one that comes with byobu:

# Initialize environment, clean up
set-environment -g BYOBU_BACKEND tmux
new-session -d byobu-janitor
set -s escape-time 0

# Change to Screen's ctrl-a escape sequence and use screen-like keys
source $BYOBU_PREFIX/share/byobu/keybindings/tmux-screen-keys.conf

# Add ^A, F12 to the prefix list
set -g prefix ^A
# Note, prefix2 only available in tmux 1.6+
set -g prefix2 F12

# Byobu's Keybindings
source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux
set-window-option -g xterm-keys on

#set-option -g set-titles on
#set-option -g set-titles-string '#(whoami)@#H - byobu (#S)'
set-option -g pane-active-border-bg $BYOBU_HIGHLIGHT
set-option -g pane-active-border-fg $BYOBU_HIGHLIGHT
set-option -g pane-border-fg $BYOBU_ACCENT
set-option -g history-limit 100000
set-option -g display-panes-time 150
set-option -g display-panes-colour $BYOBU_ACCENT
set-option -g display-panes-active-colour $BYOBU_HIGHLIGHT
set-option -g clock-mode-colour $BYOBU_ACCENT
set-option -g clock-mode-style 24
set-option -g mode-keys vi
set-option -g mode-bg $BYOBU_ACCENT
set-option -g mode-fg $BYOBU_LIGHT

set-window-option -g window-status-attr default
set-window-option -g window-status-bg $BYOBU_DARK
set-window-option -g window-status-fg $BYOBU_LIGHT
set-window-option -g window-status-current-attr reverse
set-window-option -g window-status-current-bg $BYOBU_DARK
set-window-option -g window-status-current-fg $BYOBU_LIGHT
#set-window-option -g window-status-alert-bg $BYOBU_DARK
#set-window-option -g window-status-alert-fg $BYOBU_LIGHT
#set-window-option -g window-status-alert-attr bold
set-window-option -g window-status-activity-bg $BYOBU_DARK
set-window-option -g window-status-activity-fg $BYOBU_LIGHT
set-window-option -g window-status-activity-attr bold
set-window-option -g automatic-rename on
set-window-option -g aggressive-resize on
set-window-option -g monitor-activity on

set -g default-terminal "$BYOBU_TERM"

# The following helps with Shift-PageUp/Shift-PageDown
set -g terminal-overrides 'xterm*:smcup@:rmcup@'

# Must set default-command to $SHELL, in order to not source ~/.profile
# BUG: Should *not* hardcode /bin/bash here
set -g default-command $SHELL

set -g status-bg $BYOBU_DARK
set -g status-fg $BYOBU_LIGHT
set -g status-interval 1
set -g status-left-length 256
set -g status-right-length 256
set -g status-left '#(byobu-status tmux_left)'
set -g status-right '#(byobu-status tmux_right)'$BYOBU_DATE$BYOBU_TIME
set -g message-bg $BYOBU_ACCENT
set -g message-fg white
@Krmloo commented on GitHub (Aug 26, 2020): Additional info: I'm running fish shell, theme is bobthefish. Tmux config is the default one that comes with byobu: ``` # Initialize environment, clean up set-environment -g BYOBU_BACKEND tmux new-session -d byobu-janitor set -s escape-time 0 # Change to Screen's ctrl-a escape sequence and use screen-like keys source $BYOBU_PREFIX/share/byobu/keybindings/tmux-screen-keys.conf # Add ^A, F12 to the prefix list set -g prefix ^A # Note, prefix2 only available in tmux 1.6+ set -g prefix2 F12 # Byobu's Keybindings source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux set-window-option -g xterm-keys on #set-option -g set-titles on #set-option -g set-titles-string '#(whoami)@#H - byobu (#S)' set-option -g pane-active-border-bg $BYOBU_HIGHLIGHT set-option -g pane-active-border-fg $BYOBU_HIGHLIGHT set-option -g pane-border-fg $BYOBU_ACCENT set-option -g history-limit 100000 set-option -g display-panes-time 150 set-option -g display-panes-colour $BYOBU_ACCENT set-option -g display-panes-active-colour $BYOBU_HIGHLIGHT set-option -g clock-mode-colour $BYOBU_ACCENT set-option -g clock-mode-style 24 set-option -g mode-keys vi set-option -g mode-bg $BYOBU_ACCENT set-option -g mode-fg $BYOBU_LIGHT set-window-option -g window-status-attr default set-window-option -g window-status-bg $BYOBU_DARK set-window-option -g window-status-fg $BYOBU_LIGHT set-window-option -g window-status-current-attr reverse set-window-option -g window-status-current-bg $BYOBU_DARK set-window-option -g window-status-current-fg $BYOBU_LIGHT #set-window-option -g window-status-alert-bg $BYOBU_DARK #set-window-option -g window-status-alert-fg $BYOBU_LIGHT #set-window-option -g window-status-alert-attr bold set-window-option -g window-status-activity-bg $BYOBU_DARK set-window-option -g window-status-activity-fg $BYOBU_LIGHT set-window-option -g window-status-activity-attr bold set-window-option -g automatic-rename on set-window-option -g aggressive-resize on set-window-option -g monitor-activity on set -g default-terminal "$BYOBU_TERM" # The following helps with Shift-PageUp/Shift-PageDown set -g terminal-overrides 'xterm*:smcup@:rmcup@' # Must set default-command to $SHELL, in order to not source ~/.profile # BUG: Should *not* hardcode /bin/bash here set -g default-command $SHELL set -g status-bg $BYOBU_DARK set -g status-fg $BYOBU_LIGHT set -g status-interval 1 set -g status-left-length 256 set -g status-right-length 256 set -g status-left '#(byobu-status tmux_left)' set -g status-right '#(byobu-status tmux_right)'$BYOBU_DATE$BYOBU_TIME set -g message-bg $BYOBU_ACCENT set -g message-fg white ```
Author
Owner

@Krmloo commented on GitHub (Aug 26, 2020):

After some testing I've found that the issue doesn't happen every time.

  1. Exit the session via "exit" Just close the tab, it doesn't matter how it was closed
  2. Terminal will close
  3. Launch terminal
  4. GOTO 1

Produces different results, sometimes it's correct and sometimes it isn't. Could it be some sort of race condition?
Also changing initialCols and initialRows doesn't help, incorrect window size does change, so it isn't hardcoded somewhere.

Also I'd specify that, as stated previously, this issue has appeared right after updating to 2004 and WSL2 respectively, no config changes were performed.

@Krmloo commented on GitHub (Aug 26, 2020): After some testing I've found that the issue doesn't happen every time. 1. ~~Exit the session via "exit"~~ Just close the tab, it doesn't matter how it was closed 2. Terminal will close 3. Launch terminal 4. GOTO 1 Produces different results, sometimes it's correct and sometimes it isn't. Could it be some sort of race condition? Also changing `initialCols` and `initialRows` doesn't help, incorrect window size does change, so it isn't hardcoded somewhere. Also I'd specify that, as stated previously, this issue has appeared right after updating to 2004 and WSL2 respectively, no config changes were performed.
Author
Owner

@Krmloo commented on GitHub (Aug 26, 2020):

Nevermind, issue not appearing without autostart was due to said random behaviour, so it doesn't relate to tmux at all.

Also I think that the issue may be related to something that happens during terminal launch: I've tried to reproduce (multiple times) by closing the session and launching new one from already launched terminal and it appears that issue is not present in this case.

So what size-related logic is different between first terminal launch (with WSLv2 distro being selected as default) and just opening a new tab with said distro?

@Krmloo commented on GitHub (Aug 26, 2020): Nevermind, issue not appearing without autostart was due to said random behaviour, so it doesn't relate to tmux at all. Also I think that the issue may be related to something that happens during terminal launch: I've tried to reproduce (multiple times) by closing the session and launching new one from already launched terminal and it appears that issue is not present in this case. So what size-related logic is different between first terminal launch (with WSLv2 distro being selected as default) and just opening a new tab with said distro?
Author
Owner

@zadjii-msft commented on GitHub (Sep 29, 2020):

Frankly, there shouldn't be any different logic. Here are some other ideas to help debug:

  • Does this repro with other fonts?
  • If you just slightly increase/decrease the window width in the bugged state, does the problem go away?
  • If you set "launchMode": "maximized" in your settings, is the resulting layout correct (the window will be maximized)
  • as a sanity check, does the issue repro at 100% display scaling?
@zadjii-msft commented on GitHub (Sep 29, 2020): Frankly, there shouldn't be any different logic. Here are some other ideas to help debug: * Does this repro with other fonts? * If you just slightly increase/decrease the window width in the bugged state, does the problem go away? * If you set `"launchMode": "maximized"` in your settings, is the resulting layout correct (the window will be maximized) * as a sanity check, does the issue repro at 100% display scaling?
Author
Owner

@Krmloo commented on GitHub (Sep 29, 2020):

  1. Yes
  2. Yes
  3. Still bugged, window is maximized but the terminal itself is not
  4. 100% scaling fixes it

Meanwhile, I've found a workaround.

                "padding": "8, 8, 8, 0",
                "fontSize": 11

I think that setting padding to non-default value does the same as the slight window resize.

@Krmloo commented on GitHub (Sep 29, 2020): 1. Yes 2. Yes 3. Still bugged, window is maximized but the terminal itself is not 4. 100% scaling fixes it Meanwhile, I've found a workaround. ``` "padding": "8, 8, 8, 0", "fontSize": 11 ``` I think that setting padding to non-default value does the same as the slight window resize.
Author
Owner

@zadjii-msft commented on GitHub (Jul 12, 2021):

Woah, sorry that this fell out of our triage queue! Not sure how this got lost. I think this is a real bug, but it's not one that I can repro and one that OP's already got a workaround for. So I'm thinking that we should close this one and keep our eyes open to see if there's anything similar that comes through which we can use to root cause this one.

Sorry again for the delayed response!

@zadjii-msft commented on GitHub (Jul 12, 2021): Woah, sorry that this fell out of our triage queue! Not sure how this got lost. I think this is a real bug, but it's not one that I can repro and one that OP's already got a workaround for. So I'm thinking that we should close this one and keep our eyes open to see if there's anything similar that comes through which we can use to root cause this one. Sorry again for the delayed response!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10295