[Bug] Visual selection of a wrapped line in Vim shows incorrect characters
Steps to reproduce
- Create a file named
mini.vimwith the following contents (I tried both gruvbox and solarized and observed the same behavior):
set nocompatible
set runtimepath^=/home/user/.vim/plugged/gruvbox
colorscheme gruvbox
set background=dark
set numberOpen a tmux session by running
tmux -Lx -f /dev/null.Open a file with wrapped lines while using the above Vim preferences, e.g.,
vim -u mini.vim README.md(the screenshots below show a row of a table written in markdown).See how visual selection of a wrapped line with V moves some characters to the number column and eliminates some other characters. The line wraps at the word "screen" where "s" is at the end of the top line on the screen and "creen" is at the beginning of the bottom line on the screen. After selecting the line with V the following occur:
- The letter "s" is dropped and the letter "c" in "screen" becomes the last character in the top line.
- The bottom line is dedented and starts right below the number column where naturally, there should be no text.
Before visual selection:
After visual selection:
Expected behaviour
The expected behavior is for the characters to remain in their original position.
Version of mosh
Built from the source (https://github.com/mobile-shell/mosh/commit/1105d481bb9143dad43adf768f58da7b029fd39c)
Version of Vim
9.0.1435 (tested with the latest version (1901) as well)
Version of tmux
3.2a (tested with the latest version (3.3a) as well)
Environment
Operating system: Ubuntu 22.04 accessed through mosh via macOS Ventura 13.5.2 Terminal: iTerm 2 Value of $TERM: screen-256color Shell: zsh
This issue only occurs when using mosh and inside a tmux session. Using SSH, opening Vim outside a tmux session, or local Vim/tmux do not exhibit the same behavior.
(Possibly) Related Bugs
Screen corruption with neovim (#1041)
This bug was originally reported on Vim's GitHub repository (#13101), but after a few discussions and comparison with SSH, the mosh/tmux combination seems to be the culprit.
Source: mobile-shell/mosh