From b8456fa2615480fa242c6992ca89481a8370fe5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 18 Dec 2014 13:50:19 +0100 Subject: Macro support At some point this should be optimized further at the moment there is some 20 byte overhead for each entered key. --- config.def.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'config.def.h') diff --git a/config.def.h b/config.def.h index f41dd81..16fd674 100644 --- a/config.def.h +++ b/config.def.h @@ -73,10 +73,11 @@ static void statusbar(EditorWin *win) { window_cursor_getxy(win->win, &line, &col); wattrset(win->statuswin, focused ? A_REVERSE|A_BOLD : A_REVERSE); mvwhline(win->statuswin, 0, 0, ' ', win->width); - mvwprintw(win->statuswin, 0, 0, "%s %s %s", + mvwprintw(win->statuswin, 0, 0, "%s %s %s %s", mode->name && mode->name[0] == '-' ? mode->name : "", text_filename_get(win->text), - text_modified(win->text) ? "[+]" : ""); + text_modified(win->text) ? "[+]" : "", + vis->recording ? "recording": ""); char buf[win->width + 1]; int len = snprintf(buf, win->width, "%d, %d", line, col); if (len > 0) { @@ -86,9 +87,11 @@ 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. */ + * the key is completely ignored. */ static bool vis_keypress(Key *key) { editor_info_hide(vis); + if (vis->recording) + macro_append(vis->recording, key, sizeof(*key)); return true; } @@ -407,6 +410,8 @@ static KeyBinding vis_mode_normal[] = { { { NONE('z'), NONE('t') }, window, { .w = window_redraw_top } }, { { NONE('z'), NONE('z') }, window, { .w = window_redraw_center } }, { { NONE('z'), NONE('b') }, window, { .w = window_redraw_bottom } }, + { { NONE('q') }, macro_record, { NULL } }, + { { NONE('@') }, macro_replay, { NULL } }, { /* empty last element, array terminator */ }, }; -- cgit v1.2.3