diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-05-22 11:52:59 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-05-22 11:52:59 +0200 |
| commit | 08e7ef90ca00315c4f994d20e64f67611c3fc4b5 (patch) | |
| tree | 95d082621412cf1c80dea47277dca9009b1dfa9d | |
| parent | 5c2ba124ba8706f9e9a877c78e78b21c6d2874d5 (diff) | |
| download | vis-08e7ef90ca00315c4f994d20e64f67611c3fc4b5.tar.gz vis-08e7ef90ca00315c4f994d20e64f67611c3fc4b5.tar.xz | |
vis-lua: fall back to C status bar handling if the Lua implementation is not available
| -rw-r--r-- | vis-lua.c | 37 |
1 files changed, 20 insertions, 17 deletions
@@ -16,23 +16,7 @@ #define VIS_PATH "/usr/local/share/vis" #endif -#if !CONFIG_LUA - -bool vis_lua_path_add(Vis *vis, const char *path) { return true; } -const char *vis_lua_paths_get(Vis *vis) { return NULL; } -void vis_lua_init(Vis *vis) { } -void vis_lua_start(Vis *vis) { } -void vis_lua_quit(Vis *vis) { } -void vis_lua_file_open(Vis *vis, File *file) { } -void vis_lua_file_save(Vis *vis, File *file) { } -void vis_lua_file_close(Vis *vis, File *file) { } -void vis_lua_win_open(Vis *vis, Win *win) { } -void vis_lua_win_close(Vis *vis, Win *win) { } -void vis_lua_win_highlight(Vis *vis, Win *win, size_t horizon) { } -bool vis_lua_win_syntax(Vis *vis, Win *win, const char *syntax) { return true; } -bool vis_theme_load(Vis *vis, const char *name) { return true; } - -void vis_lua_win_status(Vis *vis, Win *win) { +static void window_status_update(Vis *vis, Win *win) { char status[1024], left[256], right[256], cursors[32] = "", pos[32] = ""; int width = vis_window_width_get(win); int delim_len = 1, delim_count = 0; @@ -74,6 +58,23 @@ void vis_lua_win_status(Vis *vis, Win *win) { vis_window_status(win, status); } +#if !CONFIG_LUA + +bool vis_lua_path_add(Vis *vis, const char *path) { return true; } +const char *vis_lua_paths_get(Vis *vis) { return NULL; } +void vis_lua_init(Vis *vis) { } +void vis_lua_start(Vis *vis) { } +void vis_lua_quit(Vis *vis) { } +void vis_lua_file_open(Vis *vis, File *file) { } +void vis_lua_file_save(Vis *vis, File *file) { } +void vis_lua_file_close(Vis *vis, File *file) { } +void vis_lua_win_open(Vis *vis, Win *win) { } +void vis_lua_win_close(Vis *vis, Win *win) { } +void vis_lua_win_highlight(Vis *vis, Win *win, size_t horizon) { } +bool vis_lua_win_syntax(Vis *vis, Win *win, const char *syntax) { return true; } +bool vis_theme_load(Vis *vis, const char *name) { return true; } +void vis_lua_win_status(Vis *vis, Win *win) { window_status_update(vis, win); } + #else #if 0 @@ -1384,6 +1385,8 @@ void vis_lua_win_status(Vis *vis, Win *win) { if (lua_isfunction(L, -1)) { obj_ref_new(L, win, "vis.window"); pcall(vis, L, 1, 0); + } else { + window_status_update(vis, win); } lua_pop(L, 1); } |
