diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-05-21 23:45:34 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-05-22 00:05:31 +0200 |
| commit | 6a7f12527b1d5f562c8e762126719706329aae8b (patch) | |
| tree | 0c22b2d3b7b4fb5dbf6a12c2d2f171bebaf95d48 /vis.c | |
| parent | badb616c967f78aaae0939d794606599395ae6cc (diff) | |
| download | vis-6a7f12527b1d5f562c8e762126719706329aae8b.tar.gz vis-6a7f12527b1d5f562c8e762126719706329aae8b.tar.xz | |
vis: refactor status line handling
Make window status bar content configurable via Lua.
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -157,11 +157,17 @@ static void window_free(Win *win) { free(win); } -static void window_highlight(void *ctx) { +static void window_draw(void *ctx) { Win *win = ctx; + if (!win->ui) + return; Vis *vis = win->vis; - if (!win->file->internal && vis->event && vis->event->win_highlight) - vis->event->win_highlight(vis, win, win->horizon); + if (!win->file->internal && vis->event) { + if (win->lexer_name && vis->event->win_highlight) + vis->event->win_highlight(vis, win, win->horizon); + if (vis->event->win_status) + vis->event->win_status(vis, win); + } } Win *window_new_file(Vis *vis, File *file) { @@ -172,6 +178,7 @@ Win *window_new_file(Vis *vis, File *file) { win->file = file; win->jumplist = ringbuf_alloc(31); win->event.data = win; + win->event.draw = window_draw; win->horizon = 1 << 15; win->view = view_new(file->text, &win->event); win->ui = vis->ui->window_new(vis->ui, win->view, file, UI_OPTION_STATUSBAR); @@ -268,7 +275,6 @@ bool vis_window_syntax_set(Win *win, const char *syntax) { } free(win->lexer_name); win->lexer_name = syntax ? strdup(syntax) : NULL; - win->event.highlight = syntax ? window_highlight : NULL; return !syntax || win->lexer_name; } @@ -1133,10 +1139,6 @@ void vis_exit(Vis *vis, int status) { vis->exit_status = status; } -const char *vis_mode_status(Vis *vis) { - return vis->mode->status; -} - void vis_insert_tab(Vis *vis) { if (!vis->expandtab) { vis_insert_key(vis, "\t", 1); |
