vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit ec383ff3050806ff1aa83fcecc3973e4f59474b7
parent 9ae64af4acfed9a68b9d86b7dbc231aac43d28df
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat, 12 Mar 2016 15:56:43 +0100

view: also load lua theme for windows without syntax highlighting

This for example affects the default background color and cursor
related settings.

Diffstat:
Mview.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/view.c b/view.c @@ -209,15 +209,9 @@ static void view_syntax_color(View *view) { } bool view_syntax_set(View *view, const char *name) { - if (!name) { - free(view->lexer_name); - view->lexer_name = NULL; - return true; - } - lua_State *L = view->lua; if (!L) - return false; + return name == NULL; /* Try to load the specified lexer and parse its token styles. * Roughly equivalent to the following lua code: @@ -251,6 +245,12 @@ bool view_syntax_set(View *view, const char *name) { view->ui->syntax_style(view->ui, UI_STYLE_COLOR_COLUMN, lua_tostring(L, -1)); lua_pop(L, 1); + if (!name) { + free(view->lexer_name); + view->lexer_name = NULL; + return true; + } + lua_getfield(L, -1, "load"); lua_pushstring(L, name);