[erlang-patches] PATCH: Support for C-w and C-u in erl shell
Emad El-Haraty
emad@REDACTED
Sat Mar 17 07:09:36 CET 2007
Hi,
Attached is a patch that implements the functionality of
C-w the unix-discard-line functionality provided by readline
and C-u the kill previous word functionality
into the erlang shell:
Both properly populate the kill_buffer such that C-y behaves as
expected.
--
Emad El-Haraty E /
If you can't beat them, M\/
arrange to have them beaten. A\/
D
-------------- next part --------------
--- /usr/local/src/otp_src_R11B-3/lib/stdlib/src/edlin.erl 2006-11-06 07:52:00.000000000 -0600
+++ lib/stdlib-1.14.3/src/edlin.erl 2007-03-17 00:30:05.000000000 -0500
@@ -161,7 +161,8 @@
key_map($\^K, none) -> kill_line;
key_map($\r, none) -> new_line;
key_map($\^T, none) -> transpose_char;
-key_map($\^U, none) -> ctlu;
+%key_map($\^U, none) -> ctlu;
+key_map($\^U, none) -> kill_full_line;
key_map($\^], none) -> auto_blink;
key_map($\^X, none) -> ctlx;
key_map($\^Y, none) -> yank;
@@ -181,6 +182,7 @@
key_map($y, meta) -> yank_pop;
key_map($\177, none) -> backward_delete_char;
key_map($\177, meta) -> backward_kill_word;
+key_map($\^W, none) -> backward_kill_word;
key_map($[, meta) -> meta_left_sq_bracket;
key_map($D, meta_left_sq_bracket) -> backward_char;
key_map($C, meta_left_sq_bracket) -> forward_char;
@@ -241,6 +243,9 @@
do_op(kill_line, Bef, Aft, Rs) ->
put(kill_buffer, Aft),
{{Bef,[]},[{delete_chars,length(Aft)}|Rs]};
+do_op(kill_full_line, Bef, Aft, Rs) ->
+ put(kill_buffer, reverse(Bef)++Aft),
+ {{[],[]},[{delete_chars,-length(Bef)},{delete_chars,length(Aft)}|Rs]};
do_op(yank, Bef, [], Rs) ->
Kill = get(kill_buffer),
{{reverse(Kill, Bef),[]},[{put_chars,Kill}|Rs]};
More information about the erlang-patches
mailing list