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

Bram Moolenaar Bram at moolenaar.net
Sun Feb 24 15:47:21 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.

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)

- Bram

-- 
Light travels faster than sound.  This is why some people
appear bright until you hear them speak

 /// 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