Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmux renders with wrong size when there are several terminals #44325

Closed
Mellbourn opened this issue Feb 24, 2018 · 5 comments
Closed

tmux renders with wrong size when there are several terminals #44325

Mellbourn opened this issue Feb 24, 2018 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release terminal Integrated terminal issues verified Verification succeeded
Milestone

Comments

@Mellbourn
Copy link

Mellbourn commented Feb 24, 2018

I have the setup that was described by João Moreno (@joaomoreno) in his blog post https://medium.com/@joaomoreno/persistent-terminal-sessions-in-vs-code-8fc469ed6b41
Whenever I open a terminal tab in VS Code, i enter a tmux session (often attaching to an already present tmux session)
I love this setup! Among other things, it allows all the window control of tmux and it enables me to restart VSCode without losing my terminal session.

However, in the insiders edition (during my testing of #43683) I have experienced a new problem:

Whenever I have more than one Integrated terminal, and toggle visibility of the terminal window, the tmux window fills up with periods:

Terminal window with tmux filled with periods

Steps to Reproduce:

  1. Start VSCode Insiders edition (even without extensions)
  2. Open the integrated terminal with Cmd-Ctrl-`
  3. A tmux window is shown in the terminal window, as expected
  4. Create a new integrated terminal by pressing the + icon at the top right of the terminal window
  5. I am automatically switched to this window, as indicated by the 2: sh name of the terminal
  6. In my setup, this actually shows the same tmux window as before, since the terminal window attaches to tmux when started. This is as expected in my environment
  7. Hide the terminal window by toggling the panel, Cmd-J
  8. Show the terminal again by toggling again, Cmd-J
  9. Now, the tmux window shows a screen filled with “.” and in the lower right corner it says “(size 206x1 from a smaller client)” as if tmux was showing a much smaller window somewhere else (on the other “sh” tab?).
  10. If I switch back to the “1: sh” terminal tab, the problem goes away and tmux is rendered correctly again.

This problem recurs every time I hide the terminal and then show it again. Then the screen is again filled with “.” as if it was actively showing on a much smaller window.
I have aggressive-resize turned on in tmux, but neither having it on or off makes any difference..

The problem also occurs if I resize Visual Studio Code while I have tmux visible and have two terminals.

You might well ask why I would create extra terminal windows, when tmux already has the functionality of multiple windows. The thing is that the debugger by default creates a new terminal (see #43683). So every time I start the debugger this problem occurs.

  • VSCode Version: 1.21.0-insider ce13bb0
  • OS Version: macOS 10.13.3

This is a new problem for 1.21.0-insider. The release version 1.20.1 does not have this issue.

Does this issue occur when all extensions are disabled?: Yes

@vscodebot
Copy link

vscodebot bot commented Feb 24, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the terminal Integrated terminal issues label Feb 24, 2018
@octref octref added this to the February 2018 milestone Mar 5, 2018
@octref octref added the candidate Issue identified as probable candidate for fixing in the next release label Mar 5, 2018
@octref
Copy link
Contributor

octref commented Mar 5, 2018

@Tyriar

https://github.com/tmux/tmux/blob/master/CHANGES#L141-L143 might be of your interest.

@joaomoreno

In my setup, this actually shows the same tmux window as before, since the terminal window attaches to tmux when started. This is as expected in my environment

I'm wondering if this is what you intended, or do you have an alternative setup. (Also I'm on tmux 2.6).
For me, this script breaks when you try to have more than 1 terminal:

#!/bin/bash
SESSION="vscode`pwd | md5`"
tmux attach-session -d -t $SESSION || tmux new-session -s $SESSION

The following works (dropped the -d), because when creating new terminal tabs it'll connect to the same session without dropping all others. If I have -d when creating second terminal, the first one will be detached and closed.

#!/bin/bash
SESSION="vscode`pwd | md5`"
tmux attach-session -t $SESSION || tmux new-session -s $SESSION

@Mellbourn
Copy link
Author

Mellbourn commented Mar 5, 2018

I'm also on tmux 2.6.

This is as expected in my environment

I'm wondering if this is what you intended,

I honestly didn't think of the -d parameter. I do sometimes run the same tmux window in different places, but I haven't actually used the fact that code starts two terminals with the same window, that's mostly confusing (until you realize what is happening). What I should have said was that I intended that a tmux window to be reattached rather than a completely new shell being started.

This is the script I've been using. It seems equivalent to your second one.

#!/bin/sh
SESSION="`pwd|sed "s#$CODE_DIR/##"|sed "s#$HOME/##"|sed "s#$HOME#~#"|sed "s#\.##"`-vscode"
tmux attach-session -t $SESSION || tmux new-session -s $SESSION

I actually think adding -d works pretty well. It destroys the original terminal when the debugger creates a new terminal, but the new terminal works. It also seems less prone to the problem of the periods.

@Tyriar
Copy link
Member

Tyriar commented Mar 5, 2018

I think there was a change in the way layout happens when splitting was introduced that was causing a bad layout to happen (cols = NaN).

@Tyriar
Copy link
Member

Tyriar commented Mar 5, 2018

Pushed to master and release/1.21

@Tyriar Tyriar added the bug Issue identified by VS Code Team member as probable bug label Mar 6, 2018
@octref octref added the verified Verification succeeded label Mar 6, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release terminal Integrated terminal issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants