From 2789e5da50987b908a4aa5758a17c86570d94d63 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 7 Mar 2015 02:45:56 +0100 Subject: cleaned up usage of the escape control character: introduced CTL_KEY_ESC and CTL_KEY_ESC_STR * the reason for the CTL_KEY() macro is to get the control character resulting from a CTRL+Key press -- at least this is how SciTECO presents these key presses. It is also a macro and may be resolved to a constant expression, so it can be used in switch-case statements. Sometimes it is clearer to use standard C escape sequences (like '\t'). * CTL_KEY('[') for escape is hard to read, so I always used '\x1B' which is even more cryptic. --- src/cmdline.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/cmdline.cpp') diff --git a/src/cmdline.cpp b/src/cmdline.cpp index a995d55..888a70c 100644 --- a/src/cmdline.cpp +++ b/src/cmdline.cpp @@ -102,7 +102,7 @@ copy(void) const void Cmdline::replace(void) { - QRegister *cmdline_reg = QRegisters::globals["\x1B"]; + QRegister *cmdline_reg = QRegisters::globals[CTL_KEY_ESC_STR]; /* use heap object to avoid copy constructors etc. */ Cmdline *new_cmdline = new Cmdline(); @@ -426,11 +426,11 @@ Cmdline::process_edit_cmd(gchar key) } break; - case '\x1B': /* terminate command line */ + case CTL_KEY_ESC: /* terminate command line */ interface.popup_clear(); if (States::current == &States::start && - str && str[len-1] == '\x1B') { + str && str[len-1] == CTL_KEY_ESC) { if (Goto::skip_label) { interface.msg(InterfaceCurrent::MSG_ERROR, "Label \"%s\" not found", -- cgit v1.2.3