From b759216c0ab22f03f8dbcdfbcaae9fa41d998949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 28 Feb 2017 09:37:22 +0100 Subject: 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) --- vis-lua.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vis-lua.c') diff --git a/vis-lua.c b/vis-lua.c index 0fdf225..17f0004 100644 --- 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); } -- cgit v1.2.3