vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit e4a82ddd7e2113e4a54d57942df8f76ba729effa parent ad29a6e03bfe96f7a2a372734f3051b2a263ba24 Author: Marc André Tanner <mat@brain-dump.org> Date: Sun, 22 May 2016 18:42:09 +0200 vis: only display mode in status bar of active window Diffstat:
| M | vis-lua.c | | | 5 | +++-- |
| M | vis.lua | | | 2 | +- |
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/vis-lua.c b/vis-lua.c @@ -21,12 +21,13 @@ static void window_status_update(Vis *vis, Win *win) { int width = vis_window_width_get(win); int delim_len = 1, delim_count = 0; enum UiOption options = view_options_get(win->view); + bool focused = vis->win == win; const char *filename = win->file->name; const char *mode = vis->mode->status; int left_len = snprintf(left, sizeof(left)-1, "%s%s%s%s%s", - mode ? mode : "", - mode && ++delim_count ? " » " : "", + focused && mode ? mode : "", + focused && mode && ++delim_count ? " » " : "", filename ? filename : "[No Name]", text_modified(win->file->text) ? " [+]" : "", vis_macro_recording(vis) ? " @": ""); diff --git a/vis.lua b/vis.lua @@ -303,7 +303,7 @@ vis.events.win_status = function(win) local delim_len = 1 local mode = modes[vis.mode] - if mode ~= '' then + if mode ~= '' and vis.win == win then table.insert(left, mode) end