aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-03-19 11:51:00 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-03-19 14:58:06 +0100
commit42f04699d6df2d5b144533737a8f2f7e0814ad85 (patch)
tree3d69b94c221e3b91749b7f09b7f4da89839206ca /vis.c
parent8919fd1cbeef89aa3a5fce9c00aa708335e1de85 (diff)
downloadvis-42f04699d6df2d5b144533737a8f2f7e0814ad85.tar.gz
vis-42f04699d6df2d5b144533737a8f2f7e0814ad85.tar.xz
Move :set syntax option implementation to lua
It is no longer possible to change the used syntax by assigning to the `win.syntax = name` field, instead the function win:set_syntax(name)` should be called. The distinction between filetype and syntax lexer to use should probably be clarified/cleaned up at some point.
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/vis.c b/vis.c
index 8813500..83e1431 100644
--- a/vis.c
+++ b/vis.c
@@ -105,7 +105,6 @@ bool vis_event_emit(Vis *vis, enum VisEvents id, ...) {
case VIS_EVENT_WIN_OPEN:
case VIS_EVENT_WIN_CLOSE:
case VIS_EVENT_WIN_HIGHLIGHT:
- case VIS_EVENT_WIN_SYNTAX:
case VIS_EVENT_WIN_STATUS:
{
Win *win = va_arg(ap, Win*);
@@ -117,9 +116,6 @@ bool vis_event_emit(Vis *vis, enum VisEvents id, ...) {
vis->event->win_close(vis, win);
} else if (vis->event->win_highlight && id == VIS_EVENT_WIN_HIGHLIGHT) {
vis->event->win_highlight(vis, win, win->horizon);
- } else if (vis->event->win_syntax && id == VIS_EVENT_WIN_SYNTAX) {
- const char *syntax = va_arg(ap, const char*);
- ret = vis->event->win_syntax(vis, win, syntax);
} else if (vis->event->win_status && id == VIS_EVENT_WIN_STATUS) {
vis->event->win_status(vis, win);
}
@@ -534,7 +530,6 @@ bool vis_window_split(Win *original) {
map_copy(win->modes[i].bindings, original->modes[i].bindings);
}
win->file = original->file;
- vis_window_syntax_set(win, vis_window_syntax_get(original));
view_options_set(win->view, view_options_get(original->view));
view_cursor_to(win->view, view_cursor_get(original->view));
return true;
@@ -565,19 +560,6 @@ void vis_window_prev(Vis *vis) {
vis_window_focus(sel);
}
-const char *vis_window_syntax_get(Win *win) {
- return win->lexer_name;
-}
-
-bool vis_window_syntax_set(Win *win, const char *syntax) {
- if (!vis_event_emit(win->vis, VIS_EVENT_WIN_SYNTAX, win, syntax))
- return false;
- view_options_set(win->view, view_options_get(win->view));
- free(win->lexer_name);
- win->lexer_name = syntax ? strdup(syntax) : NULL;
- return !syntax || win->lexer_name;
-}
-
int vis_window_width_get(const Win *win) {
return win->ui->window_width(win->ui);
}