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/interface-gtk.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/interface-gtk.cpp') diff --git a/src/interface-gtk.cpp b/src/interface-gtk.cpp index e7f6927..8375dd8 100644 --- a/src/interface-gtk.cpp +++ b/src/interface-gtk.cpp @@ -196,7 +196,7 @@ InterfaceGtk::cmdline_insert_chr(gint &pos, gchar chr) * View::set_representations() */ switch (chr) { - case '\x1B': /* escape */ + case CTL_KEY_ESC: strcpy(buffer, "$"); break; case '\r': @@ -308,7 +308,7 @@ handle_key_press(bool is_shift, bool is_ctl, guint keyval) { switch (keyval) { case GDK_Escape: - cmdline.keypress('\x1B'); + cmdline.keypress(CTL_KEY_ESC); break; case GDK_BackSpace: cmdline.keypress('\b'); -- cgit v1.2.3