diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-09-17 20:28:38 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-09-17 20:28:38 +0200 |
commit | 37d1807a801d5296f00b3ac85a38b26cfe6de55c (patch) | |
tree | d44d74c0e9c2c696ec593b1156f9efab811bafa9 /src | |
parent | 0e57dd859ecb1e8a3b91509d2f4343e839340eb8 (diff) | |
download | vim-git-37d1807a801d5296f00b3ac85a38b26cfe6de55c.tar.gz |
patch 8.1.2048: not clear why SafeState and SafeStateAgain are not triggeredv8.1.2048
Problem: Not clear why SafeState and SafeStateAgain are not triggered.
Solution: Add log statements.
Diffstat (limited to 'src')
-rw-r--r-- | src/getchar.c | 2 | ||||
-rw-r--r-- | src/main.c | 14 | ||||
-rw-r--r-- | src/proto/main.pro | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 17 insertions, 3 deletions
diff --git a/src/getchar.c b/src/getchar.c index 3f3c6bca5..93d0d64ee 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -2103,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) - leave_unsafe_state(); + may_trigger_safestateagain(); may_garbage_collect = save_may_garbage_collect; diff --git a/src/main.c b/src/main.c index 42aa99034..ff3d2349f 100644 --- a/src/main.c +++ b/src/main.c @@ -1061,6 +1061,11 @@ may_trigger_safestate(int safe) && scriptin[curscript] == NULL && !global_busy; + if (was_safe != is_safe) + // Only log when the state changes, otherwise it happens at nearly + // every key stroke. + ch_log(NULL, is_safe ? "Start triggering SafeState" + : "Stop triggering SafeState"); if (is_safe) apply_autocmds(EVENT_SAFESTATE, NULL, NULL, FALSE, curbuf); was_safe = is_safe; @@ -1074,6 +1079,8 @@ may_trigger_safestate(int safe) void state_no_longer_safe(void) { + if (was_safe) + ch_log(NULL, "safe state reset"); was_safe = FALSE; } @@ -1082,10 +1089,15 @@ state_no_longer_safe(void) * SafeStateAgain, if it was safe when starting to wait for a character. */ void -leave_unsafe_state(void) +may_trigger_safestateagain(void) { if (was_safe) + { + ch_log(NULL, "Leaving unsafe area, triggering SafeStateAgain"); apply_autocmds(EVENT_SAFESTATEAGAIN, NULL, NULL, FALSE, curbuf); + } + else + ch_log(NULL, "Leaving unsafe area, not triggering SafeStateAgain"); } diff --git a/src/proto/main.pro b/src/proto/main.pro index caf435e40..873255d8f 100644 --- a/src/proto/main.pro +++ b/src/proto/main.pro @@ -5,7 +5,7 @@ int is_not_a_term(void); int op_pending(void); void may_trigger_safestate(int safe); void state_no_longer_safe(void); -void leave_unsafe_state(void); +void may_trigger_safestateagain(void); void main_loop(int cmdwin, int noexmode); void getout_preserve_modified(int exitval); void getout(int exitval); diff --git a/src/version.c b/src/version.c index 622f1687c..b8c88081d 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2048, +/**/ 2047, /**/ 2046, |