aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cmdline.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2013-02-16 02:22:51 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2013-02-16 02:22:51 +0100
commit7b16df057ce5b8cd5ad1870d5188ee11140e73b5 (patch)
treef593584458b8737738f0d7767a1e9d41dc71efc0 /src/cmdline.cpp
parentb08d5e7dad907493bc6946ab708640b567e2dffe (diff)
downloadsciteco-7b16df057ce5b8cd5ad1870d5188ee11140e73b5.tar.gz
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
Diffstat (limited to 'src/cmdline.cpp')
-rw-r--r--src/cmdline.cpp17
1 files changed, 17 insertions, 0 deletions
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)
{