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

James Vega jamessan at debian.org
Sun Feb 24 19:35:01 UTC 2008


On Sun, Feb 24, 2008 at 04:47:21PM +0100, Bram Moolenaar wrote:
> 
> 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?

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

James
[0] - http://www.xfree.org/current/ctlseqs.html
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20080224/e8680702/attachment.pgp 


More information about the pkg-vim-maintainers mailing list