vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 4e611fce5192348ccf08cdc20cf1b8d39b728a48 parent 2995f353aedd8c80f10be6e079e04df2eb6799db Author: Marc André Tanner <mat@brain-dump.org> Date: Tue, 28 Feb 2017 09:37:22 +0100 vis-lua: correctly treat return value of input event handler Returning true from the event handler, indicating that the keys were consumed, should now prevent insertion as mentioned in the documentation. vis.events.subscribe(vis.events.INPUT, function(key) if key == ' ' then -- do something fancy here return true end end) Diffstat:
| M | vis-lua.c | | | 2 | +- |
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vis-lua.c b/vis-lua.c @@ -2439,7 +2439,7 @@ static bool vis_lua_input(Vis *vis, const char *key, size_t len) { vis_lua_event_get(L, "input"); if (lua_isfunction(L, -1)) { lua_pushlstring(L, key, len); - if (pcall(vis, L, 1, 1) != 0) { + if (pcall(vis, L, 1, 1) == 0) { ret = lua_isboolean(L, -1) && lua_toboolean(L, -1); lua_pop(L, 1); }