diff --git a/babi.py b/babi.py index 8705eba..ad5a8dc 100644 --- a/babi.py +++ b/babi.py @@ -267,7 +267,7 @@ class Status: if history is not None: lst = [*self._history[history], ''] lst_pos = len(lst) - 1 - if history in self._history_prev: + if default_prev and history in self._history_prev: prompt = f'{prompt} [{self._history_prev[history]}]' else: lst = [''] diff --git a/tests/babi_test.py b/tests/babi_test.py index 71d022f..388178c 100644 --- a/tests/babi_test.py +++ b/tests/babi_test.py @@ -1541,6 +1541,18 @@ def test_save_via_command_mode(tmpdir): assert f.read() == 'hello world\n' +def test_repeated_command_mode_does_not_show_previous_command(tmpdir): + f = tmpdir.join('f') + + with run(str(f)) as h, and_exit(h): + h.press('ohai') + trigger_command_mode(h) + h.press_and_enter(':w') + trigger_command_mode(h) + h.await_text_missing(':w') + h.press('Enter') + + def test_write_and_quit(tmpdir): f = tmpdir.join('f')