You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m running mosh server built from master on Amazon Linux AMI. For a client, I’ve used iOS apps “blink” and “termius”. I can reproduce above results stably on both of the clients — note that how the start of a 3rd wrapped line is dedented.
Maybe it is a bug of my configuration, if so any help on the configuration would be appreciated.
Reacted by xero harrison, Guillaume and David Schweikert
I’ve also been having similar screen corruption issues in neovim. At this point I’ve spent a couple of hours cumulatively trying to fix this, and I finally have a (hackish) workaround.
On my server’s .zshrc, I have the following line:
alias vim="TERM=st nvim"
When using st for the value of $TERM, Neovim doesn’t mess up the indentation of soft-wrapped lines.
Despite this workaround, I’d really prefer if mosh natively solved this.
Reacted by Sean Lee, dmitrykruglov, Daniel Woodworth, Kazuhiro Homma, Jean-Luc Thumm and Gürkan
I've also been having this problem, but TERM=st (and TERM=xterm-basic) did not fix it for me. TERM=ansi did fix it, but was missing a few features that I use like 256-color support. I compared the ansi and xterm-basic terminfo and narrowed down the differences until I found the part that causes the neovim screen corruption: character set control sequences in sgr (%?%p9%t\E(0%e\E(B%;). I was able to make a new mosh profile as a workaround by removing these sequences and it seems to be working for me:
$ cat mosh.ti
mosh|less buggy mosh profile with character set control sequences removed from sgr,
sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
use=xterm-256color,
$ tic mosh.ti
$ TERM=mosh nvim
It would be nice if mosh was able to handle these sequences more gracefully if it's going to set TERM=xterm though.
Reacted by Chris Fraser, Chris Yao Qingning and Rodrigo Chacon
Mosh supports C1 controls, but is locked to Unicode only -- it doesn't support ISO 2022 charset-switching sequences on purpose. (See #1127 (comment) for a longer rationale.) neovim should be using Unicode (ISO 10646) characters when the terminal charset is Unicode and NCURSES_NO_UTF8_ACS is set, rather than ISO 2022 locking shifts into an alternate charset.
@keithw thanks for your explanation, but how can I found out which char/icon in my neovim config file or in my neovim plugin file incur this corruption.
This issue disappears when I disable lualine.nvim, and consistently reproduces when I re-enable lualine. Maybe some characters or escape sequences from lualine has been causing the issue?
Can the other commenters share whether you are using lualine (or some other *line plugins)?
I apologize for resurrecting this old issue and adding a seemingly unhelpful '+1', but I'm glad to know I'm not alone in experiencing this problem.
For years, I've been plagued by randomly broken characters in neovim, but I had no idea what was the cause, so it became a 'normal' part of my neovim experience. And today, just before finding this issue, I discovered that the problem only occurs with mosh connections, not with ssh connections or local terminals.
While I can work via ssh or locally for now, I'd be really happy it if it could be resolved.
Reacted by sobbybutter, Mar Lopez, claughinghouse, oliver makins, richseddon, Vivek Krishnaswamy, Daehyun You, Bryan, Harry H, Gürkan and 2 more
It's been several days since my remote mosh screens stopped getting corrupted while using neovim,
but I'm not sure what made the change and if it affects anyone else.
My host machine is macOS 15.4 (24E248) with kitty 0.41.1 and mosh 1.4.0 [build mosh 1.4.0],
and affected machines are:
Linux 6.6.63-v8+ (aarch64) / Debian GLIBC 2.31-13+rpt2+rpi1+deb11u11 / NVIM v0.11.0
Linux 6.8.0-1023-oracle (aarch64) / Ubuntu GLIBC 2.39-0ubuntu8.4 / NVIM v0.12.0-dev-114+g51a967d58a
and alikes.
I've been using lualine.nvim through lazyvim, but I cannot tell if there was any related fix for this issue in its repository.
I think I fixed the source of a lot of screen corruption/rendering issues in my fork. Can you all test it out and see if it's any better? Can't guarantee it gets them all, but it certainly eradicated the ones I was seeing.
Is the fix just b31161a? If so, that looks straightforward to test and merge.
Yes, it was basically a one liner.
I noticed massive screen corruption whenever I used neovim's :checkhealth which has a few warning triangle emojis in it. Tracked it down to this unique combining character which essentially transforms the glyph into its emoji representation, and ends up increasing the width to 2 as a result. Neovim has similar special logic for 0xFE0F to increase the width when it's detected (though it also requires the glyph to be an actual pictogram as well, which my one liner does not do).
I don't know if this alone is going to fix all the screen corruption reported in this issue but it certainly helped the case I was seeing.
Activity
theseanl commentedon Jul 7, 2019
SCRIPTFILE.txt
Here is a
scriptoutput recorded while reproducing the issue. Any pointer to debug would be greatly appreciated.djsavvy commentedon Jul 7, 2020
I’ve also been having similar screen corruption issues in neovim. At this point I’ve spent a couple of hours cumulatively trying to fix this, and I finally have a (hackish) workaround.
On my server’s
.zshrc, I have the following line:When using
stfor the value of$TERM, Neovim doesn’t mess up the indentation of soft-wrapped lines.Despite this workaround, I’d really prefer if mosh natively solved this.
dwoodwor-intel commentedon Sep 9, 2022
I've also been having this problem, but
TERM=st(andTERM=xterm-basic) did not fix it for me.TERM=ansidid fix it, but was missing a few features that I use like 256-color support. I compared theansiandxterm-basicterminfo and narrowed down the differences until I found the part that causes the neovim screen corruption: character set control sequences insgr(%?%p9%t\E(0%e\E(B%;). I was able to make a new mosh profile as a workaround by removing these sequences and it seems to be working for me:It would be nice if mosh was able to handle these sequences more gracefully if it's going to set
TERM=xtermthough.keithw commentedon Sep 26, 2022
Mosh supports C1 controls, but is locked to Unicode only -- it doesn't support ISO 2022 charset-switching sequences on purpose. (See #1127 (comment) for a longer rationale.) neovim should be using Unicode (ISO 10646) characters when the terminal charset is Unicode and NCURSES_NO_UTF8_ACS is set, rather than ISO 2022 locking shifts into an alternate charset.
yyb196 commentedon Aug 1, 2023
@keithw thanks for your explanation, but how can I found out which char/icon in my neovim config file or in my neovim plugin file incur this corruption.
julienmarie commentedon Mar 15, 2024
So this means it wont get fixed ? Neovim is one of the most important terminal programs out there.
ProducerMatt commentedon Jun 24, 2024
Just to show how nasty this corruption can get. Scenarios like this render it basically unusable. https://youtu.be/4ySMoZWfEgM
bergheim commentedon Jun 24, 2024
I get the same kind of corruption @ProducerMatt. Both vim and emacs.
hexacera commentedon Jul 16, 2024
This issue disappears when I disable lualine.nvim, and consistently reproduces when I re-enable lualine. Maybe some characters or escape sequences from lualine has been causing the issue?
Can the other commenters share whether you are using lualine (or some other *line plugins)?
Found a related issue in the lualine repo: Bug: when running mosh with neovim and lualine, terminal is broken #1199
dwoodwor-intel commentedon Jul 16, 2024
I wasn't using a *line plugin back when I was using mosh and encountered this issue, so the problem isn't specific to those
meinside commentedon Oct 23, 2024
I apologize for resurrecting this old issue and adding a seemingly unhelpful '+1', but I'm glad to know I'm not alone in experiencing this problem.
For years, I've been plagued by randomly broken characters in neovim, but I had no idea what was the cause, so it became a 'normal' part of my neovim experience. And today, just before finding this issue, I discovered that the problem only occurs with mosh connections, not with ssh connections or local terminals.
While I can work via ssh or locally for now, I'd be really happy it if it could be resolved.
vodrazka commentedon Apr 5, 2025
Anyone having a good workaround? I'm using mosh from Blink on iPadOS.
meinside commentedon Apr 11, 2025
It's been several days since my remote mosh screens stopped getting corrupted while using neovim,
but I'm not sure what made the change and if it affects anyone else.
My host machine is
macOS 15.4 (24E248)withkitty 0.41.1andmosh 1.4.0 [build mosh 1.4.0],and affected machines are:
Linux 6.6.63-v8+ (aarch64)/ DebianGLIBC 2.31-13+rpt2+rpi1+deb11u11/NVIM v0.11.0Linux 6.8.0-1023-oracle (aarch64)/ UbuntuGLIBC 2.39-0ubuntu8.4/NVIM v0.12.0-dev-114+g51a967d58aI've been using
lualine.nvimthrough lazyvim, but I cannot tell if there was any related fix for this issue in its repository.SichangHe commentedon May 30, 2025
Could you provide your
env, @meinside? Neovim is all over the place for me whenevertermguicolorsis on.jdrouhard commentedon Aug 20, 2025
I think I fixed the source of a lot of screen corruption/rendering issues in my fork. Can you all test it out and see if it's any better? Can't guarantee it gets them all, but it certainly eradicated the ones I was seeing.
https://github.com/jdrouhard/mosh
achernya commentedon Aug 20, 2025
Is the fix just b31161a? If so, that looks straightforward to test and merge.
jdrouhard commentedon Aug 20, 2025
Yes, it was basically a one liner.
I noticed massive screen corruption whenever I used neovim's
:checkhealthwhich has a few warning triangle emojis in it. Tracked it down to this unique combining character which essentially transforms the glyph into its emoji representation, and ends up increasing the width to 2 as a result. Neovim has similar special logic for 0xFE0F to increase the width when it's detected (though it also requires the glyph to be an actual pictogram as well, which my one liner does not do).I don't know if this alone is going to fix all the screen corruption reported in this issue but it certainly helped the case I was seeing.