From d107f8d1de766ca339f61a189bd01810af89986f Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 7 Mar 2015 03:16:49 +0100 Subject: Curses UI: fixed translation of the backspace key * for historic reasons, the backspace key can be transmitted as ^H by the terminal. Some terminal emulators might do that - these are fixed by this commit. * Use CTL_KEY('H') instead of standard C '\b' as the former is less ambiguous given the confusion around the backspace character. --- src/interface-curses.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/interface-curses.cpp') diff --git a/src/interface-curses.cpp b/src/interface-curses.cpp index e05643b..da0f158 100644 --- a/src/interface-curses.cpp +++ b/src/interface-curses.cpp @@ -509,9 +509,18 @@ event_loop_iter() interface.resize_all_windows(); break; #endif - case 0x7F: /* DEL */ + case CTL_KEY('H'): + case 0x7F: /* ^? */ case KEY_BACKSPACE: - cmdline.keypress('\b'); + /* + * For historic reasons terminals can send + * ASCII 8 (^H) or 127 (^?) for backspace. + * Curses also defines KEY_BACKSPACE, probably + * for terminals that send an escape sequence for + * backspace. + * In SciTECO backspace is normalized to ^H. + */ + cmdline.keypress(CTL_KEY('H')); break; case KEY_ENTER: case '\r': -- cgit v1.2.3