From ace15ce2127730cf8c45efcf89e4f6d9b4ecb5cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 8 Oct 2007 21:18:19 +0000 Subject: [PATCH] Changed defaults in readline to be more useful. This fixes bug #1540. Alternatively, we could add an inputrc file - this would have the advantage that other apps using readline built-in would have those, too. OTOH this really should be in the defaults, too, IMO (ie. we could do both). Opinions welcome :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22488 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/bash/lib/readline/keymaps.c | 2 +- src/bin/bash/lib/readline/readline.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bin/bash/lib/readline/keymaps.c b/src/bin/bash/lib/readline/keymaps.c index 12506d3aab..6bbecea552 100644 --- a/src/bin/bash/lib/readline/keymaps.c +++ b/src/bin/bash/lib/readline/keymaps.c @@ -105,7 +105,7 @@ rl_make_keymap () newmap[i].function = rl_insert; newmap[TAB].function = rl_insert; - newmap[RUBOUT].function = rl_rubout; /* RUBOUT == 127 */ + newmap[RUBOUT].function = rl_delete; /* RUBOUT == 127 */ newmap[CTRL('H')].function = rl_rubout; #if KEYMAP_SIZE > 128 diff --git a/src/bin/bash/lib/readline/readline.c b/src/bin/bash/lib/readline/readline.c index f583358494..6b8814ec3e 100644 --- a/src/bin/bash/lib/readline/readline.c +++ b/src/bin/bash/lib/readline/readline.c @@ -885,12 +885,23 @@ bind_arrow_keys_internal (map) _rl_keymap = xkeymap; } +/* Bind some default keys in the standard keymap. */ +static void +bind_default_keys_internal () +{ + _rl_bind_if_unbound ("\033[[", rl_end_of_line); + _rl_bind_if_unbound ("\033[@", rl_beg_of_line); + _rl_bind_if_unbound ("\033[5~", rl_history_search_backward); + _rl_bind_if_unbound ("\033[6~", rl_history_search_forward); +} + /* Try and bind the common arrow key prefixes after giving termcap and the inputrc file a chance to bind them and create `real' keymaps for the arrow key prefix. */ static void bind_arrow_keys () { + bind_default_keys_internal (); bind_arrow_keys_internal (emacs_standard_keymap); #if defined (VI_MODE)