patch 8.1.2046: SafeState may be triggered at the wrong moment
Problem: SafeState may be triggered at the wrong moment.
Solution: Move it up higher to after where messages are processed. Add a
SafeStateAgain event to tigger there.
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index d336ba9..85a5547 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -357,6 +357,7 @@
|SafeState| nothing pending, going to wait for the user to type a
character
+|SafeStateAgain| repeated SafeState
|ColorSchemePre| before loading a color scheme
|ColorScheme| after loading a color scheme
@@ -978,6 +979,11 @@
Depending on what you want to do, you may also
check more with `state()`, e.g. whether the
screen was scrolled for messages.
+ *SafeStateAgain*
+SafeStateAgain Like SafeState but after processing any
+ messages and invoking callbacks. This may be
+ triggered often, don't do something that takes
+ time.
*SessionLoadPost*
SessionLoadPost After loading the session file created using