aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-01-28 23:02:19 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-01-30 18:36:53 +0100
commit979ab795bc9d19524be524c79265c6b952199a22 (patch)
treec0635271327ffa59cd811c770d6e6f1adf9ac353 /vis.c
parent603a2d2e78d1f1dd71a2f1a7f4560e0816e3dd32 (diff)
downloadvis-979ab795bc9d19524be524c79265c6b952199a22.tar.gz
vis-979ab795bc9d19524be524c79265c6b952199a22.tar.xz
Improve Lua error reporting
Display Lua errors in a dedicated window/file. A typo or missing dependency (e.g. lpeg) in visrc.lua will no longer silently fail without any indication. The Lua integration in view.h is not yet converted.
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/vis.c b/vis.c
index 1602674..2c0d625 100644
--- a/vis.c
+++ b/vis.c
@@ -297,6 +297,8 @@ void vis_window_close(Win *win) {
vis->windows = win->next;
if (vis->win == win)
vis->win = win->next ? win->next : win->prev;
+ if (win == vis->message_window)
+ vis->message_window = NULL;
window_free(win);
if (vis->win)
vis->ui->window_focus(vis->win->ui);
@@ -309,8 +311,6 @@ Vis *vis_new(Ui *ui, VisEvent *event) {
Vis *vis = calloc(1, sizeof(Vis));
if (!vis)
return NULL;
- if (event && event->vis_start)
- event->vis_start(vis);
vis->ui = ui;
vis->ui->init(vis->ui, vis);
vis->tabwidth = 8;
@@ -324,6 +324,9 @@ Vis *vis_new(Ui *ui, VisEvent *event) {
goto err;
vis->mode_prev = vis->mode = &vis_modes[VIS_MODE_NORMAL];
vis->event = event;
+ if (event && event->vis_start)
+ event->vis_start(vis);
+ vis->ui->start(vis->ui);
return vis;
err:
vis_free(vis);