From 9efb1fb32f201c9297be9761dc12112affd04274 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Mon, 9 Jan 2012 08:23:50 -0500 Subject: [PATCH] commit bash-20110715 snapshot --- CWRU/CWRU.chlog | 7 +++++++ lib/readline/isearch.c | 20 +++++++++++++++++++- tests/COPYRIGHT | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 816265eb5..ae94a34b0 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -11967,3 +11967,10 @@ builtins/shopt.def doc/{bash.1,bashref.texi} - document new `direxpand' shopt option + + 7/15 + ---- +lib/readline/isearch.c + - _rl_isearch_dispatch: when adding character to search string, use + cxt->lastc (which we use in the switch statement) instead of c, + since lastc can be modified earlier in the function diff --git a/lib/readline/isearch.c b/lib/readline/isearch.c index de29e6163..a7b2be41f 100644 --- a/lib/readline/isearch.c +++ b/lib/readline/isearch.c @@ -394,6 +394,24 @@ _rl_isearch_dispatch (cxt, c) rl_execute_next (cxt->prevc); return (0); } + /* Otherwise, if the current character is mapped to self-insert (i.e., + not an editing command), and the previous character was a keymap + index, then we need to insert both the previous character and the + current character into the search string. */ + else if (cxt->lastc > 0 && cxt->prevc > 0 && + cxt->keymap[cxt->prevc].type == ISKMAP && + cxt->okeymap[cxt->lastc].type == ISFUNC && cxt->okeymap[cxt->lastc].function == rl_insert) + { + /* Make lastc be the next character read */ + rl_execute_next (cxt->lastc); + /* Dispatch on the previous character (insert into search string) */ + cxt->lastc = cxt->prevc; + /* Have to overwrite cxt->mb here because dispatch uses it below */ + cxt->mb[0] = cxt->lastc; + cxt->mb[1] = '\0'; + + cxt->prevc = 0; + } } /* The characters in isearch_terminators (set from the user-settable @@ -564,7 +582,7 @@ _rl_isearch_dispatch (cxt, c) } else #endif - cxt->search_string[cxt->search_string_index++] = c; + cxt->search_string[cxt->search_string_index++] = cxt->lastc; /* XXX - was c instead of lastc */ cxt->search_string[cxt->search_string_index] = '\0'; break; } diff --git a/tests/COPYRIGHT b/tests/COPYRIGHT index c69f29793..57d472109 100644 --- a/tests/COPYRIGHT +++ b/tests/COPYRIGHT @@ -1,6 +1,6 @@ Unless otherwise stated, all files in this directory are Copyright (C) 1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003, -2004,2005,2006,2007,2008,2009 +2004,2005,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc. The file ifs-posix.tests is Copyright (C) 2005 Glen Fowler. -- 2.47.3