aboutsummaryrefslogtreecommitdiff
path: root/vis-prompt.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-prompt.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-prompt.c')
-rw-r--r--vis-prompt.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/vis-prompt.c b/vis-prompt.c
index 4db1057..2441fa4 100644
--- a/vis-prompt.c
+++ b/vis-prompt.c
@@ -187,3 +187,26 @@ void vis_info_hide(Vis *vis) {
vis->ui->info_hide(vis->ui);
}
+void vis_message_show(Vis *vis, const char *msg) {
+ if (!msg)
+ return;
+ if (!vis->message_window) {
+ if (!vis_window_new(vis, NULL))
+ return;
+ vis->message_window = vis->win;
+ }
+
+ Win *win = vis->message_window;
+ Text *txt = win->file->text;
+ size_t pos = text_size(txt);
+ text_appendf(txt, "%s\n", msg);
+ text_save(txt, NULL);
+ view_cursor_to(win->view, pos);
+}
+
+void vis_message_hide(Vis *vis) {
+ if (!vis->message_window)
+ return;
+ vis_window_close(vis->message_window);
+ vis->message_window = NULL;
+}