diff options
-rw-r--r-- | doc/sciteco.7.template | 6 | ||||
-rw-r--r-- | src/cmdline.cpp | 2 | ||||
-rw-r--r-- | src/interface-curses.cpp | 13 | ||||
-rw-r--r-- | src/interface-gtk.cpp | 2 |
4 files changed, 18 insertions, 5 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template index 662ef09..a9fbd03 100644 --- a/doc/sciteco.7.template +++ b/doc/sciteco.7.template @@ -109,11 +109,15 @@ A few keys with non-printable representation are translated to control codes as well. The most prominent is the Escape key - it is translated to code 27. -The Backspace key will be translated to code 8, and the Tab key +The backspace key will always be translated to code 8, and the Tab key to code 9. Last but not least, the Return key is translated to the current buffer's end of line sequence (linefeed, carriage return followed by linefeed or just carriage return). +Naturally, all of these control codes can also be typed using a +Control-key combination (e.g. CTRL+I for the tab character) and +there is often an equivalent typed with the caret character +(e.g. \(lq^I\(rq). .IP 4. A selection of other keys without printable representation (called function keys) are translated to user-definable character sequences. diff --git a/src/cmdline.cpp b/src/cmdline.cpp index 888a70c..4a04277 100644 --- a/src/cmdline.cpp +++ b/src/cmdline.cpp @@ -268,7 +268,7 @@ Cmdline::process_edit_cmd(gchar key) modifier_enabled ? "enabled" : "disabled"); break; - case '\b': /* rubout/reinsert character */ + case CTL_KEY('H'): /* rubout/reinsert character */ interface.popup_clear(); if (modifier_enabled) 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': diff --git a/src/interface-gtk.cpp b/src/interface-gtk.cpp index 8375dd8..14dfafd 100644 --- a/src/interface-gtk.cpp +++ b/src/interface-gtk.cpp @@ -311,7 +311,7 @@ handle_key_press(bool is_shift, bool is_ctl, guint keyval) cmdline.keypress(CTL_KEY_ESC); break; case GDK_BackSpace: - cmdline.keypress('\b'); + cmdline.keypress(CTL_KEY('H')); break; case GDK_Tab: cmdline.keypress('\t'); |