Skip to content

Rendering errors in tmux split panes #6987

Closed

Description

@sw00

Environment

Windows build number: Microsoft Windows [Version 10.0.19042.388]
Windows Terminal version (if applicable): 1.0.1811.0
tmux 3.0a
Alacritty 0.4.2

Steps to reproduce

Run tmux in Windows terminal WSL2 (Ubuntu), after a fresh boot into Windows.
Create some horizontal split panes in tmux (works)
Create some vertical split panes in tmux
Run some commands with output (in some panes)

Oddly, the symptom disappears if I close and start Windows terminal again and re-attach to tmux.

Expected behavior

Text output is clear and readable and output in their respective panes.

Actual behavior

The text output from different processes seems to bleed across panes.
This occurs with a vanilla/empty tmux config too.

wsl2-tmux

My TERM is set to xterm-256color outside tmux and tmux-256color in tmux.

This behaviour also seems to happen in Alacritty (0.4.2), which in my understanding shares the same backend (ConPTY?) as Windows Terminal.

Activity

  1. ghost added
    Needs-Triage
    on Jul 21, 2020
  2. ghost added
    Needs-Tag-Fix
    on Jul 21, 2020
  3. sschlesier commented on Jul 24, 2020

    @sschlesier

    I have observed the same.

    It worked well with the first official release and then broke in the first official update.

    I installed a preview release in which it was working, but also recently broke with an update.

    I was about to try and test all the recent releases to see where it does/does not work. I noticed an odd thing. If I launch WSL2 and get a tmux session running in an old working version of the official terminal, and then attach a broken version of the preview terminal to the same tmux session the display will remain correct in both terminals. However if I close both terminals and wsl -t to terminate the wsl session, and then launch wsl and tmux again with a broken terminal it will not render correctly. That surprised me and hopefully is a helpful clue.

    For now I've run out of time to try and track this down.

  4. sschlesier commented on Jul 24, 2020

    @sschlesier

    Oh, I missed the close and start again comment. Maybe that is the factor that has made me think certain versions were fixed/broken and explains the render keeps working with both the preview and release versions.

  5. kianryan commented on Aug 12, 2020

    @kianryan

    Observing identical problems with:
    Windows Terminal Version: 1.1.2021.0
    Tmux 3.0a
    WSL 2 / Ubuntu 20.04
    TERM=xterm-256color (outside)
    TERM=tmux-256color (inside)

  6. zadjii-msft commented on Aug 19, 2020

    @zadjii-msft
    Member

    First - very sorry that this got lost in the triage queue.

    Second - does this only repro in tmux 3.0a? Maybe they're using something new in 3.0 that we don't support quite yet? I'm sitting here on 18.04 with tmux 2.6 and I just can not repro this. Lemme pull a 20.04 and see if I can't get this to happen with an updated tmux.

  7. added
    Area-VT
    Needs-Author-Feedback
    Product-Conpty
    on Aug 19, 2020
  8. zadjii-msft commented on Aug 19, 2020

    @zadjii-msft
    Member

    Huh. I could not get this to repro with a fresh ubuntu 20.04 and tmux 3.0a, UNTIL I tried installing fish:
    image

    I'm not sure if it'll happen again, but I could repro this at least once, so there's something.

    EDIT: tmux-256color is certainly a weird termcap:

    image
    image

  9. zadjii-msft commented on Aug 19, 2020

    @zadjii-msft
    Member

    Alright other findings here

    • Once a Windows Terminal pane is corrupted by this, it will stay corrupted. With the pane that's busted for me, every time I try killing all my tmux sessions and opening a new one in that WT pane, it's got the same visual corruption as OP.
    • The corruption seems to be caused by tmux or conpty causing the mouse to go back to the 1st column instead of where the pane separator should be. maybe there's a bug with calculating where the tab stops should be?
      • tmux is redrawing the contents of the bottom right pane correctly, but when I force a redraw of the entire window, then tmux will draw the corrupted rows starting from column 0, instead of the separator.
        gh-6987
  10. zadjii-msft commented on Aug 19, 2020

    @zadjii-msft
    Member

    Alright last update:

    This has definitely got something to do with line wrapping. My gut thinks that this is related to #6901/#7028/#7253, but I can't be sure, since I can't get a solid repro right now.

    Take a look at this output copied from a broken tmux and a working one. They should both have the same contents in their panes:

    image

    Note that the first one has all copied as one single wrapped line.

    I've also got the attached tracking of me opening tmux, making a [|] split, and running htop in it:
    gh-6987-trace.txt

    There's nothing terribly out of the ordinary there. I split the pane around L958, and start htop around 2215.

    I'm gonna toss this on V2, and link it up with #5800. If anyone's got a way to more consistently repro this from a fresh WT window, that'd be much appreciated. Thanks all!

  11. added
    Issue-Bug
    Priority-2
    and removed
    Needs-Author-Feedback
    on Aug 19, 2020
  12. 98 remaining items

  13. j4james commented on Feb 16, 2023

    @j4james
    Collaborator

    James Adam (@jradam) Thanks for that script capture, but you need to run script before you start vim. I know almost nothing about vim, so I'm not really sure what you're doing, but it looks to me like you've started a shell from within vim. All that's been captured is the output of that shell - the yarn execution - and nothing from vim itself.

  14. jradam commented on Feb 16, 2023

    @jradam

    James Holderness (@j4james) no problem, here's a video and scripts showing the complete flow.

    There are two scripts, as I ran it again for the new tmux window. I presume the first script would not capture what was happening in a new window. This was in a different directory, so the first script was not overwritten.

    • Glitches occur when a terminal process is running in the same Windows Terminal tab you are working in.
    • Glitches do not occur if you use a separate Windows Terminal tab to run processes.
    • The issue does occur if you are using separate tabs, but connecting to the same tmux session.

    To recreate the issue, you have to use something like tmux (or in the case of my previous video, Neovim's built-in terminal) to run a process. In the video below I use tmux. You can see visual glitches start to appear in the numberline on the left once I start editing a file.

    When I do it through tmux, opening windows does not instantly cause glitches like in my previous video. But the glitches seem to be of the same type, and either way they slowly get worse over time and spread all over the window - until your code is illegible and you have to restart Windows Terminal.

    Hope this helps!

    typescript-files.zip

    more-glitches.mp4
  15. j4james commented on Feb 16, 2023

    @j4james
    Collaborator

    James Adam (@jradam) That was perfect, thanks. This looks to me like the same problem as #14690. The DISABLE_NEWLINE_AUTO_RETURN mode has been inadvertently reset, so a line feed forces a carriage return, and when tmux or vim try to move the cursor down a line, it's also mistakenly moved to the leftmost column. This results in things being rendered in the wrong place, e.g. when hilighting the import on the second line, it gets redrawn too far to the left.

    In your case I'm assuming the mode change was triggered by yarn rather than wslsys (this would be an internal API call, so it's not something I can tell from the script log), but I'm hoping it will also be fixed by PR #14735.

  16. jradam commented on Feb 17, 2023

    @jradam

    James Holderness (@j4james) great! Hopefully that will sort it. Thanks James, looking forward to the next release then.

  17. sw00 commented on Mar 16, 2023

    @sw00
    Author

    After almost 3 years and exactly 100 comments later, I believe this has finally been fixed in the latest builds:

    OS Name:                   Microsoft Windows 11 Pro
    OS Version:                10.0.22621 N/A Build 22621
    Windows Terminal Version:  1.16.10262.0
    WSL2 OS:                   Ubuntu 20.04.5 LTS (Focal Fossa)
    WSL2 Kernel:               Linux x1ce2 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
    Tmux Version:              3.0a
    Shell:                     fish, version 3.6.0
    

    The new text rendering engine had to be enabled (I think):
    image

    Here it is in action:
    windows_terminal_fixed

    Though I haven't active in the comments, I've been following it closely as I encounter it daily in my workflow.

    I'm happy to declare this issue now resolved and closed. 🖖🏽

  18. yveslange commented on Mar 20, 2023

    @yveslange

    "Redraw entire screen when display updates" was causing me a lot of issues with Tmux, Vim and React-Scripts (the start command). Disabled and everything is fine now.

    Windows 10 - Version 21H2 - OS Build 19044.2604
    Terminal 1.16.10.261.0
    Ubuntu - WSL 2
    Tmux 3.0a
    NVIM v0.4.3

  19. inigohidalgo commented on Jun 22, 2023

    @inigohidalgo

    FWIW none of the above worked for me. What ended up doing the trick for me was setting

    set -ag terminal-overrides ',*:cud1=\E[1B'

    in my .tmux.conf

  20. added a commit that references this issue on Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-VTIssue-BugNeeds-Tag-FixPriority-1Product-Conpty

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions