vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit bc044c0533ecd0220970bd10d3c4f547c5789c5b parent e44b7748bdaa24701906553d8499362c018e4980 Author: Evan Gates <evan.gates@gmail.com> Date: Tue, 21 Sep 2021 17:51:32 -0700 vis-lua: support themes in vis:message The commit that added vis:message[0] used the existing vis_message_show function which is used internaly to display lua stack traces. That function uses the internal error_file. vis_event_emit does not trigger events for internal files in order to avoid extra lua errors when already printing a lua stack trace[1]. Due to this setup any usage of vis:message showed the text in a window with default theme/syntax/status bar colors. Instead of using the internal vis_message_show function, create a new window and file that are not marked internal in the same manner as cmd_help so themes are applied. [0]: 73f1fc7 (vis-lua: implement vis:message(msg)) [1]: 4811a65 (vis: properly redraw status bar of windows displaying internal files) Diffstat:
| M | vis-lua.c | | | 6 | +++++- |
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/vis-lua.c b/vis-lua.c @@ -781,7 +781,11 @@ static int info(lua_State *L) { static int message(lua_State *L) { Vis *vis = obj_ref_check(L, 1, "vis"); const char *msg = luaL_checkstring(L, 2); - vis_message_show(vis, msg); + if (msg && vis_window_new(vis, NULL)) { + text_appendf(vis->win->file->text, "%s\n", msg); + text_save(vis->win->file->text, NULL); + view_cursor_to(vis->win->view, 0); + } return 0; }