From 7b16df057ce5b8cd5ad1870d5188ee11140e73b5 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 16 Feb 2013 02:22:51 +0100 Subject: function key support (keys without printable representation) using keyboard macros * if enabled, when a function key is pressed it is looked up in Q-Registers ^F... e.g. HOME key corresponds to register ^FHOME * the string if available is inserted as if it was entered by key-presses (later it may be entered as a single input token which may be removed in a single rubout) * only NCurses currently, key names directly correspond to Curses key names * on Curses if function keys are enabled ESCAPE will be inserted after a delay (because function keys are transmitted via escape sequences). A function key macro may be used to define an alternative escape character --- src/cmdline.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/cmdline.cpp') diff --git a/src/cmdline.cpp b/src/cmdline.cpp index b28bfa1..e73c148 100644 --- a/src/cmdline.cpp +++ b/src/cmdline.cpp @@ -268,6 +268,23 @@ process_edit_cmd(gchar key) return insert; } +void +cmdline_fnmacro(const gchar *name) +{ + gchar macro_name[1 + strlen(name) + 1]; + QRegister *reg; + + macro_name[0] = CTL_KEY('F'); + g_strlcpy(macro_name + 1, name, sizeof(macro_name) - 1); + + reg = QRegisters::globals[macro_name]; + if (reg) { + gchar *macro = reg->get_string(); + cmdline_keypress(macro); + g_free(macro); + } +} + static gchar * macro_echo(const gchar *macro) { -- cgit v1.2.3