aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/executor.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2021-08-22 18:26:35 -0700
committerJustin M. Keyes <justinkz@gmail.com>2021-09-09 06:09:33 -0700
commit69fe427df408bc404b17d13759b2e925819c8cf7 (patch)
tree44129cb1c2b3ae27588c42452c647ec634b4877b /src/nvim/lua/executor.c
parent4eb1ebbcf703d0b7fe7dcb8d75001878a50fc137 (diff)
downloadrneovim-69fe427df408bc404b17d13759b2e925819c8cf7.tar.gz
rneovim-69fe427df408bc404b17d13759b2e925819c8cf7.tar.bz2
rneovim-69fe427df408bc404b17d13759b2e925819c8cf7.zip
feat(lua)!: register_keystroke_callback => on_key
Analogous to nodejs's `on('data', …)` interface, here on_key is the "add listener" interface. ref 3ccdbc570d85 #12536 BREAKING_CHANGE: vim.register_keystroke_callback() is now an error.
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r--src/nvim/lua/executor.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 5cd9894f9d..a8b10f86f5 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1499,7 +1499,7 @@ int nlua_expand_pat(expand_T *xp,
lua_getfield(lstate, -1, "_expand_pat");
luaL_checktype(lstate, -1, LUA_TFUNCTION);
- // [ vim, vim._log_keystroke, buf ]
+ // [ vim, vim._on_key, buf ]
lua_pushlstring(lstate, (const char *)pat, STRLEN(pat));
if (lua_pcall(lstate, 1, 2, 0) != 0) {
@@ -1773,7 +1773,7 @@ char_u *nlua_register_table_as_callable(typval_T *const arg)
return name;
}
-void nlua_execute_log_keystroke(int c)
+void nlua_execute_on_key(int c)
{
char_u buf[NUMBUFLEN];
size_t buf_len = special_to_buf(c, mod_mask, false, buf);
@@ -1787,17 +1787,17 @@ void nlua_execute_log_keystroke(int c)
// [ vim ]
lua_getglobal(lstate, "vim");
- // [ vim, vim._log_keystroke ]
- lua_getfield(lstate, -1, "_log_keystroke");
+ // [ vim, vim._on_key]
+ lua_getfield(lstate, -1, "_on_key");
luaL_checktype(lstate, -1, LUA_TFUNCTION);
- // [ vim, vim._log_keystroke, buf ]
+ // [ vim, vim._on_key, buf ]
lua_pushlstring(lstate, (const char *)buf, buf_len);
if (lua_pcall(lstate, 1, 0, 0)) {
nlua_error(
lstate,
- _("Error executing vim.log_keystroke lua callback: %.*s"));
+ _("Error executing vim.on_key Lua callback: %.*s"));
}
// [ vim ]