terminal: Rendering errors in tmux split panes
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.
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.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 101
- Comments: 102 (12 by maintainers)
Commits related to this issue
- Make all console output modes more strictly buffer state (#14735) The original console output modes were considered attributes of the buffer, while later additions were treated as global state, and ... — committed to microsoft/terminal by j4james a year ago
- fix(tmux): failed attempt to fix wsl2 + tmux + neovim rendering issues See: https://github.com/microsoft/terminal/issues/6987 https://github.com/tmux/tmux/issues/3566 https://github.com/tmux/tmux/iss... — committed to rudenkornk/dotfiles by rudenkornk a year ago
- fix(tmux): failed attempt to fix wsl2 + tmux + neovim rendering issues See: https://github.com/microsoft/terminal/issues/6987 https://github.com/tmux/tmux/issues/3566 https://github.com/tmux/tmux/iss... — committed to rudenkornk/dotfiles by rudenkornk a year ago
- Trying tmux workaround https://github.com/microsoft/terminal/issues/6987#issuecomment-1602619926 — committed to sw00/dotfiles by sw00 a year ago
- Fix: "tmux gets weird on splits" https://github.com/microsoft/terminal/issues/6987 — committed to evantravers/dotfiles by evantravers 6 months ago
Any updates on this? Having the exact same issue pretty consistently as well. Let me know if I can contribute to the troubleshooting process.
Any solution ? Still have this issue š¦
After almost 3 years and exactly 100 comments later, I believe this has finally been fixed in the latest builds:
The new text rendering engine had to be enabled (I think):
Here it is in action:
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. šš½
I solve it by adding āexperimental.rendering.forceFullRepaintā: true, to json setting file
I found a weird workaround that works for me.
opening tmux with a split in one Terminal tab. Here I see the rendering error.
open a new terminal tab and attach to the tmux session. Now the issue has miraculously disappeared
I am running into this issue also. It seems to happen when I start my React applications in a tmux split pane and the start up script would automatically open up the React application in Edge. Switching context back into Windows Terminal and I can see this issue. I can fix it simply by closing the terminal, reopening it and re-attaching the running tmux session.
Windows Terminal Version: 1.6.10571.0 Tmux: 3.0a
Iām having similar issues. Windows 10, WSL2 Windows Terminal 1.8.1032.0 Ubuntu 20.04 (fully updated 2021-05-19) tmux 3.0a
Starting tmux, running commands, clearing the screen (with
clear
) works fine until I create a split pane (ctrl+b+%).At that point running
clear
will clear only parts of the screen. The prompt is not or only partially displayed. After closing the split pane the screen is properly refreshed again.Iām using default tmux configuration (no
~/.tmux.conf
).If I ssh into a RHEL8 server first and run tmux (version 2.7) there the same problem occurs.
Note I often notice a similar problem when running
vimdiff
but I havenāt nailed down the exact steps to reproduce that reliably yet.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
Iām sorry to say, but this bug was such a deal-breaker that it prodded me to investigate alternative terminal emulators for Windows (others have already mentioned PuTTY, of course). I found Alacritty and have since moved all of my WSL workflows over to it rather than Windows Terminal. I highly recommend it ā itās GPU-accelerated and very configurable with a single YAML config file ā you can tweak arbitrary keybindings and even visual minutiae like how many pixels the window borders use, very nice if you have a tiling setup. And of course you can use your daily driver programs like tmux and vim without fear of corrupting the display and having to restart your terminal every 10 minutes lolol.
Itās been, what, like 2 years? Time to move on.
I have a fix for my issue - disable Windows Scrollback in Ubuntu Terminal - works fine now.
Iāve been assuming this would all be resolved by the epic buffer rewrite from issue #8000. Right now we canāt handle characters or character combinations that occupy two positions in the buffer, but are only meant to occupy one cell on the screen (zero width joiners are probably one case, surrogate pairs that are meant to render as narrow-width glyphs would be another).
But Iāve been thinking, if the buffer rewrite isnāt going to happen anytime soon, we might be able to hack a quick fix by just not storing those kinds of characters in the first place. Basically if we receive a zero-width joiner, just drop it. Similarly for narrow-width surrogate pairs, we could store a single error glyph instead. Itās obviously not going to look right, but at least it wonāt then break the whole layout of the page.
There may still be other problems that are causing tmux to break, but I think it would help immensely if we could rule out all the obvious buffer-related causes.
Iām facing similar issue with tmux. What Iāve noticed is that it starts to occur when I run some script via npm in other tab
Itās very irritating and blocks me from using terminal+tmux+vim. Actually, not only vim is affected, Iāve issues with tmux scroll as well, so Iām not suspecting itās a vim issue. My assumption is that npm prints some special character that breaks all other things. Are there any logs I can gather to help troubleshoot this issue?
Npm packages used:
How did I not see this before? Maybe GH auto-collapsing bits of the thread? Dang that reproās all the way back to conhost:
So thatās at least the root of the issue. Now how do we reconcile what conhost thinks here with what tmux thinks? Thatās the hard question.
This bug occurs sometimes for me. Horizontal splits always work, vertical ones sometimes bomb.
As a temporary workaround Iāve found that detaching my tmux session, then reattaching to it, resolves the problem for me. Not my favorite, but at least itās something so I can move past the bug.
Windows 10 v21H2 build:
19044.1415
Windows Feature Experience Pack:120.2212.3920.0
Windows Terminal:1.11.3471.0
WSL:Version 2, Ubuntu-18.04, Kernel v5.10.60.1
Windows 10 Pro Terminal version: 1.10.2714.0 Tmux: 2.8-3 Debian: 10.10 WSL2
Same issue, was gone for a few months and now returned possibly due to some update of something.
Edit: updating tot debian 11/tmux 3.1c didnāt help. The issue did reappear (on a fresh tmux session) upon running
yarn start
in a tmux pane for acreate-react-app
application.@j4james provided this one liner that consistently breaks tmux on WSL for me
FWIW, weāre pretty confident that
"experimental.rendering.forceFullRepaint": true
shouldnāt actually fix this. It might coincidentally fix this, by forcing a reboot of the Terminal, and maybe makes it harder to get into this state. But presumably this is due to a desync between the ConPTY buffer and the Terminal one, and thatās not somethingforceFullRepaint
would affect.I have experience the same issue
the split screen function can only work in horizontal split, not vertical split.
Short summary: what I was describing can be a combination of WSL2 + Windows Terminal (version 1.5.10411.0). On a different machine, the same problem does not reproduce with a WSL1 distro. On the same machine, switching to Windows Terminal Preview from Microsoft Store should also fix the problem.
Here are more a few more detailed notes: (I was using Pengwin for WSL on all three machines listed below.)
Apologize for not including all the details. Here are the Windows specifications for the desktop machine where I took the screenshot. I was using Windows Terminal version 1.5.10411.0, downloaded directly from Microsoft Store. I am using WSL2 on this machine.
Also, with the same version of Windows Terminal from Microsoft Store, the problem is reproduced on a T480 laptop with Win 10 Pro Version 1909. (Well, Pengwin is installed as WSL2 here.)
However, on another Lenovo T480 laptop with the following specifications, the Windows Terminal from the Store should work without a problem.
Here is a screenshot from the 2nd T480 laptop with Win 10 Pro Version 20H2. It is clean as it should be.
Note, this is Pengwin installed as WSL1.
Looks like the Windows Termianl Preview (version 1.6.10412.0) does not produce the Tmux problem, though. Glad to find another viable alternative emulator.
Huh. I could not get this to repro with a fresh ubuntu 20.04 and tmux 3.0a, UNTIL I tried installing
fish
: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:@j4james great! Hopefully that will sort it. Thanks James, looking forward to the next release then.
for whoever this helps, I had no luck with any version or even with alacritty, HOWEVER recently came across WezTerm https://wezfurlong.org/wezterm/install/windows.html and it has worked like a charm. Very easy to setup and configure, and no rendering issues.
While ~70% of the issues have been fixed by disabling scrollback - I continue to see problems and corruptions - more often on my large 30" monitor - and almost always when I do a vertical split of a window into two tmux panes - Horizontal splits are rarely a problem. I have a (horrible) workaround - which is to kill the tmux-server and restart it (resurrection plugin restores all my panes/scroll back - so not the end of the world). This is definitely a windows terminal issues - I used tmux for 2+ years on a linux system - never once saw a corruption - and I see it daily on windows terminal. What I find surprising is that surely there are a lot of people who (A) use WSL, (B) used tmux, Ā© use windows terminal - so there must be a lot of people experiencing this problem every day - Unless splitting a window vertically is just an uncommon thing.?
I am experiencing this issue in both windows terminal and alacritty.
Referencing an alacritty issue (https://github.com/alacritty/alacritty/issues/5483) as it says it might be a windows bug not alacritty/terminal
Here is what happens in Alacritty
https://user-images.githubusercontent.com/47204120/171546527-4565676b-f6fa-4dc8-af68-339ab919d0dc.mp4
NOTE: Weirdly enough, the render issue only happens in vertical tmux splits not horizontal (at least in my case)
Nope. Weāll make sure to update this thread when there is.
I couldnāt get a consistent set of repro steps for this the last time I investigated this: https://github.com/microsoft/terminal/issues/6987#issuecomment-676510163. I havenāt had a chance to try again since. If someone could find an exact set of āuse these settings, this tmux config, run this, that anotherā to repro this consistently, that would be much appreciated.
I suspect it has something to do with wide/narrow characters like the ones commonly found in nerdfonts powerline setups, but a consistent repro without those should also be possible.
I had the same issue for a year now until I set
LANG=en_US.UTF8
usingsudo update-locale LANG=en_US.UTF8
as well asexport LANG=en_US.UTF8
I also have
set -g default-terminal "xterm-256color"
in my.tmux.conf
and tmux aliased toalias tmux="TERM=xterm-256color tmux -2"
Windows 11 Build 22000.282 Windows Terminal: 1.102714.0 Tmux: tmux 3.0a OS: Ubuntu 20.04.3 LTS on Windows 10 x86_64
Edit: Nope it doesnāt work š
Windows 11 Windows Terminal 1.10.2383.0 Tmux: 3.0a Ubuntu: 20.04.3 LTS
Still having the issue š¦
Sadly without any solution, it is really difficult to develop with Microsoft Terminal and tmux. I am back to mintty/wsltty
This is still easy to break by using a unicode sequence that Windows Terminal doesnāt render with the correct width. For example, try something like this:
Youāll see the output from the left pane goes straight across into the right pane like this:
If youāre using a fancy prompt with emoji in (like the cloud in @G-Rathās screenshot above), I suspect that might be the cause of your tmux rendering problems.
ā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
@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.
I honestly donāt really think thereās anything in 1.16.3460 that would have fixed this⦠Iād be excited to find out that it was fixed by chance.
https://github.com/microsoft/terminal/compare/v1.15.3465.0...v1.16.3463.0
Maybe:
okay 200 commits later and that looks like the only one that might affect this. But Iām pretty sure WSL wouldnāt be invoking a
ReadConsoleOutput
at any point. Weird. There are some changes in 1.17 that do more to mess with the buffer. Those changes Iād think would be more likely to improve this. That being said, the repro in https://github.com/microsoft/terminal/issues/6987#issuecomment-917256763 is still broken in 1.17, so š¤·^ Can confirm I donāt have this issue anymore with the Preview version 1.16.3460.0, thanks @theanuragshukla!
If Anyone is still having this issue, try installing Windows Terminal Preview from the microsoft store. Hopefully this issue will be resolved in upcoming versions of Terminal.
I was also finding refuge in Alacritty (have been a very happy user of it on Linux and MacOS for years) but in Windows Alacritty still has problems dealing with the system clipboard and NeoVim mouse events (https://github.com/alacritty/alacritty/issues/1663). These days to mitigate the bug in question I just have to run my Nodejs servers in a separate WT tab without Tmux.
I donāt feel that a āgreatā terminal emulator should have this problem, but I have to use it this way at work and consider it just another Windows UX hazard that breaks the Unix immersion of using WSL interactively.
@ghshephard Do you have more information on how to disable the setting you mentioned?
This happens here as well. WSL 2, Ubuntu22.04, Windows Terminal Version: 1.13.11431.0. Tmux 3.2A. Closing the terminal window or detaching from tmux resolves the issue.something seems to be happening when firefox is launched for the CRA dev server.
Launching firefox directly from the Ubuntu shell does not cause the issue.
Setting the CRA start script to
"start": "BROWSER=none react-scripts start
prevents the browser from auto-launching, and prevents the issue.I think that @zadjii-msft is right that at least in some cases this is caused by advanced prompt setups with things such as powerline.
I did some testing today and was unable to reproduce the issue for myself if I set my shell to bash with no customization, but with my normal zsh + loads of nonsense, it is essentially unusable with a vertical split.
I am using zsh with Oh My ZSH!
My guess is that if you just set up the minimal Oh My ZSH! setup, it will replicate the issue.
Let me know if there is anything I can do to help move this along in the way of testing or providing examples of how to reproduce it.
Want to report that even with neovim split, still produced the same kind of display artifacts
Still having rendering issues using tmux with nvim on Windows Terminal Preview 1.7.572.0 I generally use tmux to split panes A temporary work around for my issue was to use Windows Terminalās built in split panes I remapped most of the command shortcuts to be similar to tmuxās with the help of this https://docs.microsoft.com/en-us/windows/terminal/panes
Nope, still a problem for me with that version.
I now attribute the "new variant " of rendering error to vim-prosession, a Vim-plugin. To be more specific, I was including an
E0056
character when I askvim-prosession
to update the window name when I entervim
from the command line. The following settings in.vimrc
shall reproduce the problem.Note, on the 2nd line, there was an
E0056
char betweenV
and-
. Inspecting the string"Vó -@@@"
here shall revealE0056
.For a good number of months, though, the
E0056
char has been rendered properly with wsltty. Looks like Windows Terminal (or Preview) cannot handle theE0056
char properly when it is inserted into the status bar for Tmux.I am having a slightly different problem, where the status bar for tmux should grow ātallerā by duplicating itself. It also inserts a line with
This is observed both on tmux sessions running in a local WSL instance, or tmux sessions hosted on remote Linux machines. The
b-21
or21
at the bottom. Tmux shortcuts are not working as intended as well..tmux.config
file for both tmux sessions are identical, as I source from the same Dropbox directory.To note, all these problems go away should I stay with wsltty.
Alright other findings here