Mercurial > vim
comparison src/main.c @ 18106:b456bba1276a v8.1.2048
patch 8.1.2048: not clear why SafeState and SafeStateAgain are not triggered
Commit: https://github.com/vim/vim/commit/37d1807a801d5296f00b3ac85a38b26cfe6de55c
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 17 20:28:38 2019 +0200
patch 8.1.2048: not clear why SafeState and SafeStateAgain are not triggered
Problem: Not clear why SafeState and SafeStateAgain are not triggered.
Solution: Add log statements.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 17 Sep 2019 20:30:04 +0200 |
parents | e59ff7b5d7a7 |
children | 76126690dd92 |
comparison
equal
deleted
inserted
replaced
18105:360d654e8479 | 18106:b456bba1276a |
---|---|
1059 && stuff_empty() | 1059 && stuff_empty() |
1060 && typebuf.tb_len == 0 | 1060 && typebuf.tb_len == 0 |
1061 && scriptin[curscript] == NULL | 1061 && scriptin[curscript] == NULL |
1062 && !global_busy; | 1062 && !global_busy; |
1063 | 1063 |
1064 if (was_safe != is_safe) | |
1065 // Only log when the state changes, otherwise it happens at nearly | |
1066 // every key stroke. | |
1067 ch_log(NULL, is_safe ? "Start triggering SafeState" | |
1068 : "Stop triggering SafeState"); | |
1064 if (is_safe) | 1069 if (is_safe) |
1065 apply_autocmds(EVENT_SAFESTATE, NULL, NULL, FALSE, curbuf); | 1070 apply_autocmds(EVENT_SAFESTATE, NULL, NULL, FALSE, curbuf); |
1066 was_safe = is_safe; | 1071 was_safe = is_safe; |
1067 } | 1072 } |
1068 | 1073 |
1072 * may_trigger_safestate(). | 1077 * may_trigger_safestate(). |
1073 */ | 1078 */ |
1074 void | 1079 void |
1075 state_no_longer_safe(void) | 1080 state_no_longer_safe(void) |
1076 { | 1081 { |
1082 if (was_safe) | |
1083 ch_log(NULL, "safe state reset"); | |
1077 was_safe = FALSE; | 1084 was_safe = FALSE; |
1078 } | 1085 } |
1079 | 1086 |
1080 /* | 1087 /* |
1081 * Invoked when leaving code that invokes callbacks. Then trigger | 1088 * Invoked when leaving code that invokes callbacks. Then trigger |
1082 * SafeStateAgain, if it was safe when starting to wait for a character. | 1089 * SafeStateAgain, if it was safe when starting to wait for a character. |
1083 */ | 1090 */ |
1084 void | 1091 void |
1085 leave_unsafe_state(void) | 1092 may_trigger_safestateagain(void) |
1086 { | 1093 { |
1087 if (was_safe) | 1094 if (was_safe) |
1095 { | |
1096 ch_log(NULL, "Leaving unsafe area, triggering SafeStateAgain"); | |
1088 apply_autocmds(EVENT_SAFESTATEAGAIN, NULL, NULL, FALSE, curbuf); | 1097 apply_autocmds(EVENT_SAFESTATEAGAIN, NULL, NULL, FALSE, curbuf); |
1098 } | |
1099 else | |
1100 ch_log(NULL, "Leaving unsafe area, not triggering SafeStateAgain"); | |
1089 } | 1101 } |
1090 | 1102 |
1091 | 1103 |
1092 /* | 1104 /* |
1093 * Main loop: Execute Normal mode commands until exiting Vim. | 1105 * Main loop: Execute Normal mode commands until exiting Vim. |