Bug#456033: Possible fix for strange vim behaviour

Robert Luberda robert at debian.org
Wed Feb 20 23:06:57 UTC 2008


clone 456033 -1
reassign -1 vim 1:7.1-245+1
retile -1 'vim: incorrectly parses device attributes string'
tags -1 -patch -pending
thanks



On Wed, 19 Dec 2007, Jan Christoph Nordholz wrote:

Hi, 


> I don't get the spurious 'c', but the beep indeed. I only use
> nvi (which is unaffected), and I didn't try every editor around,
> hoping that the problem description above that AC_INIT macro was
> complete. (I initially wanted to make it '0.5.3+svn254', but had
> refrained from doing so to avoid having characters in it.)

I have this problem as well. I've traced it and discovered that 
vim sends the special CSI sequence `ESC[>c' and it gets from mrxvt the
following response: `ESC[>82;0.5.3+25;0c'

Than I looked into vim's code (term.c):
	 if (*T_CRV != NUL && ((tp[0] == ESC && tp[1] == '[' && len >= 3)
                                               || (tp[0] == CSI && len >= 2)))
            {
                j = 0;
                extra = 0;
                for (i = 2 + (tp[0] != CSI);
                        i < len && (VIM_ISDIGIT(tp[i])
                            || tp[i] == ';' || tp[i] == '.'); ++i)
                    if (tp[i] == ';' && ++j == 1)
                        extra = atoi((char *)tp + i + 1);
                if (i == len)
                    return -1;          /* not enough characters */

                /* eat it when at least one digit and ending in 'c' */
                if (i > 2 + (tp[0] != CSI) && tp[i] == 'c')
                {
		[ snip ]
		}
	}	
I didn't debugged it, but it seems to be quite obvious that vim except 
the response to contain only digits, comas and semicolons, and it fails 
on `+' character.   

I tried to find out what characters are valid in the response, but the
only site I found (http://invisible-island.net/xterm/ctlseqs/ctlseqs.html) 
says only: 

CSI > P s c Send Device Attributes (Secondary DA)
[ snip ]	
??? CSI > P p ; P v ; P c c
and P v is the firmware version (for xterm, this was originally the XFree86 patch number, 
starting with 95). 


Anyway vim should probably skip all unknowns charaters until it finds the ";c"
string, so I'm cloning the bug for vim.



Regards,
robert



More information about the pkg-vim-maintainers mailing list