Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] vi weird when I ssh to one machine



Darren Cook writes:

 > Hope you are all okay, not too shaken :-)

Shaken but not stirred.

 > The working machine writes:
 >   write(1, "\33[?2-- INSERT --  ____  1,1  ____   All) = 62
 > 
 > (Where I've put ____ is a bunch of spaces, just reformatting for email)
 > 
 > The problem machine writes:
 >  write(1, "\33[?2004l\33[>4;m", 14*[>4;m)      = 14
 > 
 > Where I've put "*" is 0x0018.

I suspect there's a problem with the transcription (the strings aren't
terminated with quotation marks, the control sequences seem to be
incomplete; maybe there are control codes embedded in the strings?)

I don't know what the working machine is trying to do, the sequence
"\33[?2" (where the \33 represents the ASCII ESC control character)
should be followed by optional digits and punctuation and terminated
by a letter or certain punctuation, but not including "-".  The
"-- INSERT --" string looks familiar, I guess this is displayed by vi
as a mode line.  So the sequence is incomplete and there are at least
a dozen valid sequences beginning with "\33[?2".  One interesting
possibility is "\33[?2J", which means "Erase in Display (DECSED),
VT220, Ps = 2 ⇒ Selective Erase All", one way to clear the screen.
Aside from the poor formatting of the strace output, that seems pretty
consistent with what I would expect vi to do on startup with no file.

The non-working machine is bizarre.  "\33[?2004l" appears to be a
complete sequence, which means "DEC Private Mode Reset (DECRST),
Ps = 2 0 0 4  ⇒  Reset bracketed paste mode", whatever that is.
"\33[>4;m" sounds plausible, but I don't know what it actually does:
"Set/reset key modifier options (XTMODKEYS), xterm, Pp = 4  ⇒
modifyOtherKeys".  Presumably it has to do with whether you can use
Alt combinations as in Emacs (which interferes with function keys).  I
have no idea what the 0x18 (Ctl-X) means; it doesn't appear to be an
xterm control sequence.

My guess is that either the two terminfos differ in the terminal
initialization sequence, or the initialization sequence is customized
in at least one of the machines.

The bizarre definitions are copied from
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
which is for masochists.  (Don't copy any commas when copying to a
search box, I changed some periods to commas so they read better, and
the "Px =" parameter definition phrases usually have other text after
the function name but before the parameter so copying the whole thing
won't work for sure.)

Steve


Home | Main Index | Thread Index