@@ -1061,6 +1061,11 @@ may_trigger_safestate(int safe)
10611061 && scriptin [curscript ] == NULL
10621062 && !global_busy ;
10631063
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" );
10641069 if (is_safe )
10651070 apply_autocmds (EVENT_SAFESTATE , NULL , NULL , FALSE, curbuf );
10661071 was_safe = is_safe ;
@@ -1074,6 +1079,8 @@ may_trigger_safestate(int safe)
10741079 void
10751080state_no_longer_safe (void )
10761081{
1082+ if (was_safe )
1083+ ch_log (NULL , "safe state reset" );
10771084 was_safe = FALSE;
10781085}
10791086
@@ -1082,10 +1089,15 @@ state_no_longer_safe(void)
10821089 * SafeStateAgain, if it was safe when starting to wait for a character.
10831090 */
10841091 void
1085- leave_unsafe_state (void )
1092+ may_trigger_safestateagain (void )
10861093{
10871094 if (was_safe )
1095+ {
1096+ ch_log (NULL , "Leaving unsafe area, triggering SafeStateAgain" );
10881097 apply_autocmds (EVENT_SAFESTATEAGAIN , NULL , NULL , FALSE, curbuf );
1098+ }
1099+ else
1100+ ch_log (NULL , "Leaving unsafe area, not triggering SafeStateAgain" );
10891101}
10901102
10911103
0 commit comments