From 00490cd08427250aaabc4fca791d8c0381b95fde Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 31 Jul 2022 20:48:38 +0200 Subject: Rename "disable_history" stack state to "noninteractive" The commit after next will fix a bug where we wrongly disable prompt history in some scenarios. The root cause is that life span of "disable_history" does not model when we actually want to disable history. Let's rename the state variable to "noninteractive". It's set whenever we are executing a hook, mapping or command. Note that it's also active inside ":prompt"'s callback, which doesn't play well with the new name :( --- src/input_handler.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/input_handler.cc') diff --git a/src/input_handler.cc b/src/input_handler.cc index a36d13f1..4e953738 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -1197,7 +1197,7 @@ private: void history_push(StringView entry) { - if (entry.empty() or context().history_disabled() or + if (entry.empty() or context().noninteractive() or (m_flags & PromptFlags::DropHistoryEntriesWithBlankPrefix and is_horizontal_blank(entry[0_byte]))) return; @@ -1772,7 +1772,7 @@ void InputHandler::handle_key(Key key) KeymapManager& keymaps = m_context.keymaps(); if (keymaps.is_mapped(key, keymap_mode) and not m_context.keymaps_disabled()) { - ScopedSetBool disable_history{context().history_disabled()}; + ScopedSetBool noninteractive{context().noninteractive()}; for (auto& k : keymaps.get_mapping_keys(key, keymap_mode)) process_key(k); -- cgit v1.2.3