diff --git a/src/input_handler.cc b/src/input_handler.cc index 217f3a5c..2a14fc71 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -1430,6 +1430,9 @@ void InputHandler::repeat_last_insert() if (m_last_insert.keys.empty()) return; + if (dynamic_cast(¤t_mode()) == nullptr) + throw runtime_error{"repeating last insert not available in this context"}; + Vector keys; swap(keys, m_last_insert.keys); ScopedSetBool disable_hooks(context().hooks_disabled(), diff --git a/test/regression/1469-assert-on-repeat-insert/cmd b/test/regression/1469-assert-on-repeat-insert/cmd new file mode 100644 index 00000000..44f1421d --- /dev/null +++ b/test/regression/1469-assert-on-repeat-insert/cmd @@ -0,0 +1 @@ +i!echo tchou. diff --git a/test/regression/1469-assert-on-repeat-insert/in b/test/regression/1469-assert-on-repeat-insert/in new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/regression/1469-assert-on-repeat-insert/in @@ -0,0 +1 @@ + diff --git a/test/regression/1469-assert-on-repeat-insert/out b/test/regression/1469-assert-on-repeat-insert/out new file mode 100644 index 00000000..89bd8679 --- /dev/null +++ b/test/regression/1469-assert-on-repeat-insert/out @@ -0,0 +1,2 @@ +tchou + diff --git a/test/regression/787-crash-after-S/out b/test/regression/787-crash-after-S/out index e69de29b..8b137891 100644 --- a/test/regression/787-crash-after-S/out +++ b/test/regression/787-crash-after-S/out @@ -0,0 +1 @@ + diff --git a/test/run b/test/run index 2d0e3d86..a9d35d41 100755 --- a/test/run +++ b/test/run @@ -19,7 +19,7 @@ main() { eval -buffer *debug* write debug quit! } - exec "%sh{cat cmd}" + try %{ exec "%sh{cat cmd}" } exec eval -buffer *debug* write debug nop %sh{