aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Szilagyi <[email protected]>2015-07-16 13:17:30 +0200
committerTom Szilagyi <[email protected]>2015-07-16 13:24:26 +0200
commita3a8d25c8d884fe086d7d8ee3ebdcc732abb0abc (patch)
treede9d581592beb6ebcf005d5a29c3ed9bebf1d759
parent745563e98f6993e279703dc1ad1e9a2c38dfac28 (diff)
downloadotp-a3a8d25c8d884fe086d7d8ee3ebdcc732abb0abc.tar.gz
otp-a3a8d25c8d884fe086d7d8ee3ebdcc732abb0abc.tar.bz2
otp-a3a8d25c8d884fe086d7d8ee3ebdcc732abb0abc.zip
Erlang shell: Support keys Del, Home and End
Add support for the Delete, Home and End keys in the Erlang shell. These keys are ubiquitous on modern keyboards. Having them working as expected adds to the convenience of working in the shell, since they are much easier to use than the corresponding Ctrl-{D,A,E} keys. The implementation is in line with the existing framework of the line editor and is thus a natural (and minimal) extension.
-rw-r--r--lib/stdlib/src/edlin.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/stdlib/src/edlin.erl b/lib/stdlib/src/edlin.erl
index 8c7a984f1c..19444c0502 100644
--- a/lib/stdlib/src/edlin.erl
+++ b/lib/stdlib/src/edlin.erl
@@ -227,6 +227,8 @@ key_map($F, meta_o) -> end_of_line;
key_map($\177, none) -> backward_delete_char;
key_map($\177, meta) -> backward_kill_word;
key_map($[, meta) -> meta_left_sq_bracket;
+key_map($H, meta_left_sq_bracket) -> beginning_of_line;
+key_map($F, meta_left_sq_bracket) -> end_of_line;
key_map($D, meta_left_sq_bracket) -> backward_char;
key_map($C, meta_left_sq_bracket) -> forward_char;
% support a few <CTRL>+<CURSOR LEFT|RIGHT> combinations...
@@ -237,8 +239,10 @@ key_map($[, meta_meta) -> meta_csi;
key_map($C, meta_csi) -> forward_word;
key_map($D, meta_csi) -> backward_word;
key_map($1, meta_left_sq_bracket) -> {csi, "1"};
+key_map($3, meta_left_sq_bracket) -> {csi, "3"};
key_map($5, meta_left_sq_bracket) -> {csi, "5"};
key_map($5, {csi, "1;"}) -> {csi, "1;5"};
+key_map($~, {csi, "3"}) -> forward_delete_char;
key_map($C, {csi, "5"}) -> forward_word;
key_map($C, {csi, "1;5"}) -> forward_word;
key_map($D, {csi, "5"}) -> backward_word;