Bug#466789: Parsing of "terminal version" response too strict?

Bram Moolenaar Bram at moolenaar.net
Sun Feb 24 21:50:26 UTC 2008


James -

> > > In term.c's check_termcode, there is code to handle the response to
> > > "CSI>0c" (request terminal version) which is of the form
> > > "CSI>{x};{vers};{y}c".  The format of {vers} isn't strictly defined but
> > > the current code assumes that the response will only be made up of
> > > digits, ';', and '.'.
> > > 
> > > When this assumption is wrong (as was the case with a recent mrxvt
> > > version which contained a '+'), the parsing stops early and any unparsed
> > > characters end up being fed to Vim as if they were key presses by the
> > > user.  This caused anyone using Vim inside mrxvt to start in
> > > operator-pending mode from the 'c' that Vim received.
> > > 
> > > I've attached a patch which simply reduces the conditional check of the
> > > for loop that does the parsing to "i < len && tp[i] != 'c'".
> > 
> > The problem with checking for a 'c' is that we gobble up too much if we
> > get another escape sequence.
> 
> We may be parsing something other than a response to T_CRV here?

We don't know what it is.  Could be a function key.

> > I think every escape sequence is supposed to end in a letter.  So we
> > could use this loop:
> > 
> > 	for (i = 2 + (tp[0] != CSI); i < len && !ASCII_ISALPHA(tp[i]); ++i)
> 
> Quickly looking over xterm's control sequences[0], there are sequences
> that don't end in a letter but responses to T_CRV should always end in
> c.

You mean sequences that are send to the xterm?  We were talking about
sequences that xterm sends back to the application and start with CSI.

Oh, these sequences can also end in '~', I'll add that.

- Bram

-- 
The future isn't what it used to be.

 /// Bram Moolenaar -- Bram at Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///





More information about the pkg-vim-maintainers mailing list