aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/keymap.c11
-rw-r--r--src/nvim/state.c4
2 files changed, 12 insertions, 3 deletions
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index 2d117b5308..eab65f2625 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -940,3 +940,14 @@ char_u *replace_termcodes(const char_u *from, const size_t from_len,
return *bufp;
}
+/// Logs a single key as a human-readable keycode.
+void log_key(int log_level, int key)
+{
+ if (log_level < MIN_LOG_LEVEL) {
+ return;
+ }
+ char *keyname = key == K_EVENT
+ ? "K_EVENT"
+ : (char *)get_special_key_name(key, mod_mask);
+ LOG(log_level, "input: %s", keyname);
+}
diff --git a/src/nvim/state.c b/src/nvim/state.c
index 7c7d035366..dbf04eebec 100644
--- a/src/nvim/state.c
+++ b/src/nvim/state.c
@@ -65,9 +65,7 @@ getkey:
}
#if MIN_LOG_LEVEL <= DEBUG_LOG_LEVEL
- char *keyname = key == K_EVENT
- ? "K_EVENT" : (char *)get_special_key_name(key, mod_mask);
- DLOG("input: %s", keyname);
+ log_key(DEBUG_LOG_LEVEL, key);
#endif
int execute_result = s->execute(s, key);