diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-12 16:45:03 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-12 17:38:45 +0200 |
| commit | 658cf9236c6a45fd54d668886fadd3df8532e0a3 (patch) | |
| tree | 184347b33daba1a173a6cf9a095293eae2361762 /config.def.h | |
| parent | 35b7e991e2d9c53380bd103461b74438d61503c1 (diff) | |
| download | vis-658cf9236c6a45fd54d668886fadd3df8532e0a3.tar.gz vis-658cf9236c6a45fd54d668886fadd3df8532e0a3.tar.xz | |
Use the new global keypress hook to hide user messages
Diffstat (limited to 'config.def.h')
| -rw-r--r-- | config.def.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/config.def.h b/config.def.h index 80eaf13..8206cac 100644 --- a/config.def.h +++ b/config.def.h @@ -61,7 +61,7 @@ static Command cmds[] = { }; /* draw a statubar, do whatever you want with win->statuswin curses window */ -static void statusbar(EditorWin *win) { +static void vis_statusbar(EditorWin *win) { size_t line, col; bool focused = vis->win == win || vis->prompt->editor == win; window_cursor_getxy(win->win, &line, &col); @@ -77,6 +77,13 @@ static void statusbar(EditorWin *win) { } } +/* called before any other keybindings are checked, if the function returns false + * the key is completely ignored. used to clear a user visible message. */ +static bool vis_keypress(Key *key) { + editor_info_hide(vis); + return true; +} + static KeyBinding basic_movement[] = { { { KEY(LEFT) }, movement, { .i = MOVE_CHAR_PREV } }, { { KEY(SLEFT) }, movement, { .i = MOVE_WORD_START_PREV } }, @@ -701,8 +708,18 @@ static Mode nano[] = { * argv[0] i.e. program name upon execution */ static Config editors[] = { - { .name = "vis", .mode = &vis_modes[VIS_MODE_NORMAL], .statusbar = statusbar }, - { .name = "nano", .mode = &nano[1], .statusbar = statusbar }, + { + .name = "vis", + .mode = &vis_modes[VIS_MODE_NORMAL], + .statusbar = vis_statusbar, + .keypress = vis_keypress, + }, + { + .name = "nano", + .mode = &nano[1], + .statusbar = vis_statusbar, + .keypress = vis_keypress, + }, }; /* Color definitions, by default the i-th color is used for the i-th syntax |
