summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2025-03-23 16:16:24 +0100
committerMaxime Coste <mawww@kakoune.org>2025-03-24 08:28:55 +1100
commit6fa99d403c0d5884610fd23e59a2fc10ed258a9a (patch)
tree8b067f7ae821fcfb42f4bda0fb60a359518a9c77
parent43782d0ca11b4eff14ff3ab8274de20140f3567c (diff)
Default InputHandler::handle_key() synthesized argument
We have only one place where we handle actual keys typed by the user.
-rw-r--r--src/client.cc2
-rw-r--r--src/commands.cc4
-rw-r--r--src/input_handler.cc2
-rw-r--r--src/input_handler.hh2
-rw-r--r--src/main.cc2
-rw-r--r--src/normal.cc4
6 files changed, 8 insertions, 8 deletions
diff --git a/src/client.cc b/src/client.cc
index 2fa8e8fb..da4ed9f0 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -112,7 +112,7 @@ bool Client::process_pending_inputs()
else
{
context().ensure_cursor_visible = true;
- m_input_handler.handle_key(key, false);
+ m_input_handler.handle_key(key, /*synthesized=*/false);
}
context().hooks().run_hook(Hook::RawKey, to_string(key), context());
diff --git a/src/commands.cc b/src/commands.cc
index c9e68060..6da92d67 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -2223,7 +2223,7 @@ const CommandDesc execute_keys_cmd = {
ScopedSetBool disable_hooks(context.hooks_disabled(), not parser.get_switch("with-hooks"));
for (auto& key : parser | transform(parse_keys) | flatten())
- context.input_handler().handle_key(key, true);
+ context.input_handler().handle_key(key);
});
}
};
@@ -2696,7 +2696,7 @@ void enter_user_mode(Context& context, String mode_name, KeymapMode mode, bool l
ScopedEdition edition(context);
for (auto& key : context.keymaps().get_mapping_keys(key, mode))
- context.input_handler().handle_key(key, true);
+ context.input_handler().handle_key(key);
}
if (lock)
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 5ec3615b..b6539ce2 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -1612,7 +1612,7 @@ void InputHandler::repeat_last_insert()
push_mode(new InputModes::Insert(*this, m_last_insert.mode, m_last_insert.count, nullptr));
for (auto& key : m_last_insert.keys)
- handle_key(key, true);
+ handle_key(key);
kak_assert(dynamic_cast<InputModes::Normal*>(&current_mode()) != nullptr);
}
diff --git a/src/input_handler.hh b/src/input_handler.hh
index 32e9bfca..0a908892 100644
--- a/src/input_handler.hh
+++ b/src/input_handler.hh
@@ -91,7 +91,7 @@ public:
Timer::Callback idle_callback = Timer::Callback{});
// process the given key
- void handle_key(Key key, bool synthesized);
+ void handle_key(Key key, bool synthesized = true);
void refresh_ifn();
diff --git a/src/main.cc b/src/main.cc
index e95725ec..78318b5b 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -997,7 +997,7 @@ int run_filter(StringView keystr, ConstArrayView<StringView> files, bool quiet,
};
for (auto& key : keys)
- input_handler.handle_key(key, true);
+ input_handler.handle_key(key);
}
catch (runtime_error& err)
{
diff --git a/src/normal.cc b/src/normal.cc
index 6aa5b703..6be1a857 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -1613,7 +1613,7 @@ void replay_macro(Context& context, NormalParams params)
do
{
for (auto& key : keys)
- context.input_handler().handle_key(key, true);
+ context.input_handler().handle_key(key);
} while (--params.count > 0);
}
@@ -2085,7 +2085,7 @@ void exec_user_mappings(Context& context, NormalParams params)
ScopedEdition edition(context);
ScopedSelectionEdition selection_edition{context};
for (auto& key : context.keymaps().get_mapping_keys(key, KeymapMode::User))
- context.input_handler().handle_key(key, true);
+ context.input_handler().handle_key(key);
}, "user mapping",
build_autoinfo_for_mapping(context, KeymapMode::User, {}));
}