contour
contour copied to clipboard
Terminal size is not respected with profile with ssh.
Contour Terminal version
Contour Terminal Emulator 0.6.1
Installer source
something else (please specify below)
Operating System
Fedora 40
Architecture
x86-64
Other Software
OpenSSH_9.6p1, OpenSSL 3.2.2 4 Jun 2024 — I am pretty sure this is irrelevant, but ¯\_(ツ)_/¯
Steps to reproduce
- Create this configuration:
foo:
ssh:
host: foo # ← should be a real host…
port: 22
user: yann
terminal_size:
columns: 120
lines: 24
- Run
contour profile foo - Notice the terminal has 80 character width, not 120.
- Remove the ssh segment.
- Run
contour profile foo - Notice the terminal has 120 character width.
Expected Behavior
The terminal should have a width of 120.
Actual Behavior
The terminal has a width of 80, the default.
Additional notes
No response
Hi @kierun, thanks for the bug report, it might be that ssh served changes the size of the terminal on connection, can you please provide the output of the contour from following debug flags: pty and vt.grid
Command to run : contour debug "pty,vt.grid" profile foo
@Yaraslaut here goes:
√ ; contour debug "pty,vt.grid" profile anduril
zsh: correct 'profile' to '.profile' [nyae]? n
[2025-01-16 08:53:43.709337] [vt.grid] resize 120x24 -> 80x24 (cursor (23, 0))
[2025-01-16 08:53:43.709405] [vt.grid] resize 120x1 -> 80x1 (cursor (0, 0))
[2025-01-16 08:53:43.709415] [vt.grid] resize 120x1 -> 80x1 (cursor (0, 0))
[2025-01-16 08:53:43.871188] [vt.grid] resize 80x24 -> 86x25 (cursor (23, 4))
[2025-01-16 08:53:43.871576] [vt.grid] resize 80x1 -> 86x1 (cursor (0, 0))
[2025-01-16 08:53:43.871585] [vt.grid] resize 80x1 -> 86x1 (cursor (0, 0))
Well, look at that first line… :rage:
So, next question: is there a way to stop this from happening?
If I use the profile large and manually ssh, the window does not automatically resize. It stays at 120 width. :thinking:
Sorry for the late reply @kierun, I will try to repro this and update on what we can do
Hm, i can not reproduce this behaviour @kierun, here is my output when I connect to the remote server
yaraslau@Cartan ⇒ ./build/src/contour/contour debug "vt.grid,ssh" profile remote
ninja: no work to do.
QML debugging is enabled. Only use this in a safe environment.
[2025-01-26 17:07:48.812861] [vt.grid] resize 120x24 -> 120x23 (cursor (0, 0))
[2025-01-26 17:07:48.812892] [vt.grid] -> shrink lines: numLinesToShrink 1, linesAvailableBelowCursorBeforeShrink 23, cutoff 1, pushUp 0/0
[2025-01-26 17:07:48.812901] [ssh] (contour) Resizing PTY to 120x23.
[2025-01-26 17:07:48.812955] [ssh] Starting SSH session to host: [email protected]
[2025-01-26 17:07:48.812962] [ssh] (contour) State transition from Initial to Started.
[2025-01-26 17:07:48.812966] [ssh] (contour) State transition from Started to Connect.
[2025-01-26 17:07:48.839326] [ssh] Connected to 159.65.115.185
[2025-01-26 17:07:48.839347] [ssh] (contour) State transition from Connect to Handshake.
[2025-01-26 17:07:49.043847] [ssh] (contour) State transition from Handshake to VerifyHostKey.
[2025-01-26 17:07:49.043874] [ssh] Skipping host key verification, because no known_hosts file was specified.
[2025-01-26 17:07:49.043881] [ssh] (contour) State transition from VerifyHostKey to AuthenticateAgent.
[2025-01-26 17:07:49.043893] [ssh] (contour) State transition from AuthenticateAgent to AuthenticatePrivateKeyStart.
[2025-01-26 17:07:49.140710] [ssh] Successfully authenticated with private key.
[2025-01-26 17:07:49.140746] [ssh] (contour) State transition from AuthenticatePrivateKeyStart to OpenChannel.
[2025-01-26 17:07:49.280844] [ssh] (contour) State transition from OpenChannel to RequestAuthAgent.
[2025-01-26 17:07:49.280895] [ssh] (contour) State transition from RequestAuthAgent to RequestPty.
[2025-01-26 17:07:49.302509] [ssh] (contour) State transition from RequestPty to SetEnv.
[2025-01-26 17:07:49.302527] [ssh] (contour) State transition from SetEnv to StartShell.
[2025-01-26 17:07:49.326746] [ssh] (contour) State transition from StartShell to Operational.
[2025-01-26 17:07:49.345038] [vt.grid] resize 120x23 -> 120x22 (cursor (22, 0))
[2025-01-26 17:07:49.345050] [vt.grid] -> shrink lines: numLinesToShrink 1, linesAvailableBelowCursorBeforeShrink 0, cutoff 0, pushUp 1/1
[2025-01-26 17:07:49.345055] [vt.grid] -> numLinesToPushUp 1
[2025-01-26 17:07:49.345061] [ssh] (contour) Resizing PTY to 120x22.
[2025-01-26 17:07:49.345066] [ssh] (contour) State transition from Operational to ResizeScreen.
[2025-01-26 17:07:49.345089] [ssh] (contour) State transition from ResizeScreen to Operational.
[2025-01-26 17:07:49.370676] [vt.grid] resize 120x22 -> 120x23 (cursor (21, 0))
[2025-01-26 17:07:49.370700] [ssh] (QSGRenderThread) Resizing PTY to 120x23.
[2025-01-26 17:07:49.370707] [ssh] (QSGRenderThread) State transition from Operational to ResizeScreen.
[2025-01-26 17:07:49.370744] [ssh] (QSGRenderThread) State transition from ResizeScreen to Operational.
[2025-01-26 17:07:49.394851] [ssh] (contour) Resizing PTY to 120x23.
[2025-01-26 17:07:49.394889] [ssh] (contour) State transition from Operational to ResizeScreen.
[2025-01-26 17:07:49.394917] [ssh] (contour) State transition from ResizeScreen to Operational.
maybe you can also add ssh debug info?
@Yaraslaut Ah, that's annoying that you cannot reproduce it. Therefore, the problem is something in my settings… Dammit.
Here's the output, still the same behaviour.
√ ; contour profile anduril debug "vt.grid,ssh"
zsh: correct 'profile' to '.profile' [nyae]? n
[2025-01-27 09:27:29.498658] [ssh] Starting SSH session to host: yann@anduril
[2025-01-27 09:27:29.498686] [ssh] (contour) State transition from Initial to Started.
[2025-01-27 09:27:29.498696] [ssh] (contour) State transition from Started to Connect.
[2025-01-27 09:27:29.512210] [ssh] Connected to anduril (151.236.219.169)
[2025-01-27 09:27:29.512230] [ssh] (contour) State transition from Connect to Handshake.
[2025-01-27 09:27:29.627419] [ssh] (contour) State transition from Handshake to VerifyHostKey.
[2025-01-27 09:27:29.627449] [ssh] Skipping host key verification, because no known_hosts file was specified.
[2025-01-27 09:27:29.627465] [ssh] (contour) State transition from VerifyHostKey to AuthenticateAgent.
[2025-01-27 09:27:29.670271] [ssh] Successfully authenticated with SSH agent with identity: [email protected]
[2025-01-27 09:27:29.670305] [ssh] (contour) State transition from AuthenticateAgent to OpenChannel.
[2025-01-27 09:27:30.313584] [ssh] (contour) State transition from OpenChannel to RequestAuthAgent.
[2025-01-27 09:27:30.313672] [ssh] (contour) State transition from RequestAuthAgent to RequestPty.
[2025-01-27 09:27:30.328497] [ssh] (contour) State transition from RequestPty to SetEnv.
[2025-01-27 09:27:30.328524] [ssh] (contour) State transition from SetEnv to StartShell.
[2025-01-27 09:27:30.343100] [ssh] (contour) State transition from StartShell to Operational.
[2025-01-27 09:27:30.435074] [vt.grid] resize 120x24 -> 80x24 (cursor (23, 0))
[2025-01-27 09:27:30.435137] [vt.grid] resize 120x1 -> 80x1 (cursor (0, 0))
[2025-01-27 09:27:30.435146] [vt.grid] resize 120x1 -> 80x1 (cursor (0, 0))
[2025-01-27 09:27:30.435156] [ssh] (contour) Resizing PTY to 80x24.
[2025-01-27 09:27:30.435164] [ssh] (contour) State transition from Operational to ResizeScreen.
[2025-01-27 09:27:30.435213] [ssh] (contour) State transition from ResizeScreen to Operational.
[2025-01-27 09:27:30.568798] [vt.grid] resize 80x24 -> 86x25 (cursor (23, 4))
[2025-01-27 09:27:30.569425] [vt.grid] resize 80x1 -> 86x1 (cursor (0, 0))
[2025-01-27 09:27:30.569443] [vt.grid] resize 80x1 -> 86x1 (cursor (0, 0))
[2025-01-27 09:27:30.569458] [ssh] (QSGRenderThread) Resizing PTY to 86x25.
[2025-01-27 09:27:30.569475] [ssh] (QSGRenderThread) State transition from Operational to ResizeScreen.
[2025-01-27 09:27:30.569578] [ssh] (QSGRenderThread) State transition from ResizeScreen to Operational.
[2025-01-27 09:27:30.435156] [ssh] (contour) Resizing PTY to 80x24.
I guess this is where the behaviour happens. But, why? What crazy feature do I have that does that? 🤔
Thanks for the update, @kierun. I can reproduce this issue if I explicitly add a resize VT sequence to the .bashrc file.
to resize to 80x25 in .bashrc use: printf "\e[8;25;80t"
Thanks for the update,
@kierun. I can reproduce this issue if I explicitly add a resize VT sequence to the
.bashrcfile. to resize to 80x25 in.bashrcuse:printf "\e[8;25;80t"
😱 Well, that's odd… I tried commenting out ~/.bashrc, .zshrc, and .profile and I still get the same behaviour. 😖 I am at a loss. This happens only on contour, not xterm, rxvt, or alacrity…
@Yaraslaut Thank you for your help so far. If you feel this should be closed, please do. I'll try to figure it out and add a comment when (if?) I do. Of course, if you wished to help further, I would be grateful!
You can try to check out system wide file /etc/profile maybe something going on there, overall check out man page of the shell that you are using it must tell the the order of files that it uses during startup
The difference between ssh mode of the contour is that we connect directly to the server, without the sshd spawned from a shell in between