1
0
forked from aniani/vim

updated for version 7.3.431

Problem:    Fetching a key at a prompt may be confused by escape sequences.
            Especially when getting a prompt at a VimEnter autocommand.
            (Alex Efros)
Solution:   Properly handle escape sequences deleted by check_termcode().
This commit is contained in:
Bram Moolenaar
2012-02-05 22:05:48 +01:00
parent 73b2470896
commit a8c8a688ac
5 changed files with 50 additions and 20 deletions

View File

@@ -3785,14 +3785,16 @@ set_mouse_topline(wp)
* With a match, the match is removed, the replacement code is inserted in
* typebuf.tb_buf[] and the number of characters in typebuf.tb_buf[] is
* returned.
* When "buf" is not NULL, it is used instead of typebuf.tb_buf[]. "buflen" is
* then the length of the string in buf[].
* When "buf" is not NULL, buf[bufsize] is used instead of typebuf.tb_buf[].
* "buflen" is then the length of the string in buf[] and is updated for
* inserts and deletes.
*/
int
check_termcode(max_offset, buf, buflen)
check_termcode(max_offset, buf, bufsize, buflen)
int max_offset;
char_u *buf;
int buflen;
int bufsize;
int *buflen;
{
char_u *tp;
char_u *p;
@@ -3864,10 +3866,10 @@ check_termcode(max_offset, buf, buflen)
}
else
{
if (offset >= buflen)
if (offset >= *buflen)
break;
tp = buf + offset;
len = buflen - offset;
len = *buflen - offset;
}
/*
@@ -5002,12 +5004,18 @@ check_termcode(max_offset, buf, buflen)
if (extra < 0)
/* remove matched characters */
mch_memmove(buf + offset, buf + offset - extra,
(size_t)(buflen + offset + extra));
(size_t)(*buflen + offset + extra));
else if (extra > 0)
/* insert the extra space we need */
{
/* Insert the extra space we need. If there is insufficient
* space return -1. */
if (*buflen + extra + new_slen >= bufsize)
return -1;
mch_memmove(buf + offset + extra, buf + offset,
(size_t)(buflen - offset));
(size_t)(*buflen - offset));
}
mch_memmove(buf + offset, string, (size_t)new_slen);
*buflen = *buflen + extra + new_slen;
}
return retval == 0 ? (len + extra + offset) : retval;
}