mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.1.0140: recording into a register has focus events
Problem: Recording into a register has focus events. (Michael Naumann) Solution: Don't record K_FOCUSGAINED and K_FOCUSLOST. (closes #3143)
This commit is contained in:
@@ -1246,27 +1246,43 @@ del_typebuf(int len, int offset)
|
|||||||
static void
|
static void
|
||||||
gotchars(char_u *chars, int len)
|
gotchars(char_u *chars, int len)
|
||||||
{
|
{
|
||||||
char_u *s = chars;
|
char_u *s = chars;
|
||||||
int c;
|
int i;
|
||||||
char_u buf[2];
|
static char_u buf[4];
|
||||||
int todo = len;
|
static int buflen = 0;
|
||||||
|
int todo = len;
|
||||||
|
|
||||||
/* remember how many chars were last recorded */
|
|
||||||
if (reg_recording != 0)
|
|
||||||
last_recorded_len += len;
|
|
||||||
|
|
||||||
buf[1] = NUL;
|
|
||||||
while (todo--)
|
while (todo--)
|
||||||
{
|
{
|
||||||
|
buf[buflen++] = *s++;
|
||||||
|
|
||||||
|
// When receiving a special key sequence, store it until we have all
|
||||||
|
// the bytes and we can decide what to do with it.
|
||||||
|
if (buflen == 1 && buf[0] == K_SPECIAL)
|
||||||
|
continue;
|
||||||
|
if (buflen == 2)
|
||||||
|
continue;
|
||||||
|
if (buflen == 3 && buf[1] == KS_EXTRA
|
||||||
|
&& (buf[2] == KE_FOCUSGAINED || buf[2] == KE_FOCUSLOST))
|
||||||
|
{
|
||||||
|
// Drop K_FOCUSGAINED and K_FOCUSLOST, they are not useful in a
|
||||||
|
// recording.
|
||||||
|
buflen = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle one byte at a time; no translation to be done. */
|
/* Handle one byte at a time; no translation to be done. */
|
||||||
c = *s++;
|
for (i = 0; i < buflen; ++i)
|
||||||
updatescript(c);
|
updatescript(buf[i]);
|
||||||
|
|
||||||
if (reg_recording != 0)
|
if (reg_recording != 0)
|
||||||
{
|
{
|
||||||
buf[0] = c;
|
buf[buflen] = NUL;
|
||||||
add_buff(&recordbuff, buf, 1L);
|
add_buff(&recordbuff, buf, (long)buflen);
|
||||||
|
/* remember how many chars were last recorded */
|
||||||
|
last_recorded_len += buflen;
|
||||||
}
|
}
|
||||||
|
buflen = 0;
|
||||||
}
|
}
|
||||||
may_sync_undo();
|
may_sync_undo();
|
||||||
|
|
||||||
|
@@ -789,6 +789,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
140,
|
||||||
/**/
|
/**/
|
||||||
139,
|
139,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user