mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
vim-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 vim/vim#3143)
972bfddc6b
This commit is contained in:
@@ -1096,26 +1096,40 @@ void del_typebuf(int len, int offset)
|
|||||||
* Write typed characters to script file.
|
* Write typed characters to script file.
|
||||||
* If recording is on put the character in the recordbuffer.
|
* If recording is on put the character in the recordbuffer.
|
||||||
*/
|
*/
|
||||||
static void gotchars(char_u *chars, size_t len)
|
static void gotchars(const char_u *chars, size_t len)
|
||||||
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
char_u *s = chars;
|
const char_u *s = chars;
|
||||||
int c;
|
static char_u buf[4] = { 0 };
|
||||||
|
static size_t buflen = 0;
|
||||||
|
size_t todo = len;
|
||||||
|
|
||||||
// remember how many chars were last recorded
|
while (todo--) {
|
||||||
if (reg_recording != 0) {
|
buf[buflen++] = *s++;
|
||||||
last_recorded_len += len;
|
|
||||||
}
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
while (len--) {
|
|
||||||
// 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 (size_t i = 0; i < buflen; i++) {
|
||||||
updatescript(c);
|
updatescript(buf[i]);
|
||||||
|
}
|
||||||
|
|
||||||
if (reg_recording != 0) {
|
if (reg_recording != 0) {
|
||||||
char buf[2] = { (char)c, NUL };
|
buf[buflen] = NUL;
|
||||||
add_buff(&recordbuff, buf, 1L);
|
add_buff(&recordbuff, (char *)buf, (ptrdiff_t)buflen);
|
||||||
|
// remember how many chars were last recorded
|
||||||
|
last_recorded_len += buflen;
|
||||||
}
|
}
|
||||||
|
buflen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
may_sync_undo();
|
may_sync_undo();
|
||||||
|
|
||||||
/* output "debug mode" message next time in debug mode */
|
/* output "debug mode" message next time in debug mode */
|
||||||
|
@@ -240,8 +240,8 @@ enum key_extra {
|
|||||||
, KE_DROP = 95 // DnD data is available
|
, KE_DROP = 95 // DnD data is available
|
||||||
// , KE_CURSORHOLD = 96 // CursorHold event
|
// , KE_CURSORHOLD = 96 // CursorHold event
|
||||||
, KE_NOP = 97 // no-op: does nothing
|
, KE_NOP = 97 // no-op: does nothing
|
||||||
, KE_FOCUSGAINED = 98 // focus gained
|
// , KE_FOCUSGAINED = 98 // focus gained
|
||||||
, KE_FOCUSLOST = 99 // focus lost
|
// , KE_FOCUSLOST = 99 // focus lost
|
||||||
// , KE_MOUSEMOVE = 100 // mouse moved with no button down
|
// , KE_MOUSEMOVE = 100 // mouse moved with no button down
|
||||||
// , KE_CANCEL = 101 // return from vgetc
|
// , KE_CANCEL = 101 // return from vgetc
|
||||||
, KE_EVENT = 102 // event
|
, KE_EVENT = 102 // event
|
||||||
|
Reference in New Issue
Block a user