diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-03-07 03:16:49 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-03-07 03:16:49 +0100 |
commit | d107f8d1de766ca339f61a189bd01810af89986f (patch) | |
tree | 3297152f484603e40aed82e80fbee75db82f4991 /src/interface-curses.cpp | |
parent | 2789e5da50987b908a4aa5758a17c86570d94d63 (diff) | |
download | sciteco-d107f8d1de766ca339f61a189bd01810af89986f.tar.gz |
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.
Diffstat (limited to 'src/interface-curses.cpp')
-rw-r--r-- | src/interface-curses.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
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': |