Corrupt display when editing remotely via ssh

32 views
Skip to first unread message

Norm Wood

unread,
Dec 17, 2017, 3:47:49 AM12/17/17
to v...@vim.org
Hi,

I'm having problems with garbling of the displayed text when ssh'ing
into
a remote machine to edit a file. Here's a 'MWE' of the steps that
produce
the problem.

1. Open xterm on local_machine (Slackware 14.1), check environment:
TERM is 'xterm'
XTERM_VERSION is 'X.Org 7.6.0(297)

2. Ssh to remote_machine (CentOS 6.9), and I'm in a pseudo terminal:
$ ps -o 'cmd=' -pp $(ps -o 'ppid=' -p $$)
returns (for example):
sshd: me@pts/14

3. Check the environment on remote_machine:
TERM is 'xterm'

4. Open a text file for editing:
$ vim -N -u NONE myfile.txt

The vim version on remote_machine is 7.4.629, and is compiled with
+terminfo and ++builtin_terms.

5. Check value of 'term in Vim:
:set term
and it shows 'term=xterm'

6. Move around using e.g. Ctrl-f, Ctrl-b, do some deletions and
insertions, and text gets garbled (details below).

Interestingly, if I then explicitly set the terminal in Vim:
:set term=xterm
the garbling goes away...


The "garbling" duplicates that reported by Lowell Specht in this thread:

https://groups.google.com/forum/#!searchin/vim_use/ssh$20redraw|sort:relevance/vim_use/vJZJMe4fFgE/brm6sh1aBgAJ
or
https://tinyurl.com/k9t7a4g

For example, moving around with Ctrl-f and Ctrl-b causes many lines to
be duplicated and not wrap correctly. Resizing the window does the same
thing. Eventually, any displayed line is a jumble of blocks of text
from other
lines.

When deleting characters from a line, trailing characters are left in
their
original positions. For example, applying '4x' to 'rain' in 'The rain
in Spain stays
mainly in the plain.' leaves 'The in Spain stays mainly in the
plain.ain.'. Executing
':redraw' or ':redraw!' has no effect. If I save the garbled file and
reopen it, I get a
proper-looking file.

Obviously, I have a fairly simple work-around (set the terminal
explicitly each
time I start Vim), but if anyone can suggest the cause and a solution, I
would
appreciate it.

Regards,
Norm

Dick Riegner

unread,
Jun 7, 2018, 2:13:23 PM6/7/18
to v...@vim.org
Norm,

I am seeing the same problem using vim on remote Linux systems and
displaying back to macOS running XQuartz (X11) server 2.7.11.

Thanks for the work-around. I made it a bit more permanent by adding these
statements to my ~/.vimrc file:

" Work-around for garbage/corrupt edit display back to
" macOS XQuartz (X11) server with newer vi/vim
if (&term == 'xterm')
set term=dummy
set term=xterm
endif

Any idea on the root cause of this problem? How to get it fixed?

Thanks.

Dick Riegner



--
Sent from: http://vim.1045645.n5.nabble.com/Vim-General-f1139531.html
Reply all
Reply to author
Forward
0 new messages