1
0
forked from aniani/vim

patch 8.1.2053: SafeStateAgain not triggered if callback uses feedkeys()

Problem:    SafeStateAgain not triggered if callback uses feedkeys().
Solution:   Check for safe state in the input loop.  Make log messages easier
            to find. Add 'S' flag to state().
This commit is contained in:
Bram Moolenaar
2019-09-18 21:15:31 +02:00
parent 7a9bd7c1e0
commit d103ee7843
5 changed files with 51 additions and 17 deletions

View File

@@ -933,7 +933,7 @@ ins_typebuf(
init_typebuf();
if (++typebuf.tb_change_cnt == 0)
typebuf.tb_change_cnt = 1;
state_no_longer_safe();
state_no_longer_safe("ins_typebuf()");
addlen = (int)STRLEN(str);
@@ -1797,7 +1797,7 @@ vgetc(void)
// Need to process the character before we know it's safe to do something
// else.
if (c != K_IGNORE)
state_no_longer_safe();
state_no_longer_safe("key typed");
return c;
}
@@ -2047,6 +2047,7 @@ parse_queued_messages(void)
int i;
int save_may_garbage_collect = may_garbage_collect;
static int entered = 0;
int was_safe = get_was_safe_state();
// Do not handle messages while redrawing, because it may cause buffers to
// change or be wiped while they are being redrawn.
@@ -2102,7 +2103,7 @@ parse_queued_messages(void)
// When not nested we'll go back to waiting for a typed character. If it
// was safe before then this triggers a SafeStateAgain autocommand event.
if (entered == 1)
if (entered == 1 && was_safe)
may_trigger_safestateagain();
may_garbage_collect = save_may_garbage_collect;