mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix an issue with the up arrow key in Emacs editing mode.
Emacs editing mode is bugged in ksh93u+ and ksh2020. Let's say you were to run the following commands after starting a fresh instance of ksh: $ alias foo='true' $ unalias foo If you type 'a' and then press the up arrow on your keyboard, ksh will complete 'a' to `alias foo='true'` by doing a reverse search for the last command that starts with 'a'. Run the alias command again, then type 'u' and press the up arrow key again. If ksh is in Vi mode, you will get `unalias foo`, but in Emacs mode you will get `alias foo='true'` again. This bug was occurring because ksh was only doing a reverse search based on the first command that was completed using the up arrow. All subsequent commands were ignored as ksh was saving the first command and only based later searches off of it. NEWS: - Add instructions for reproducing this bug with the up arrow key and information about why this bug was happening in the first place. src/cmd/ksh93/edit/emacs.c: - Remove a bad check that was preventing ksh from using the latest input for reverse search. (cherry picked from commit 745b065487ad6bac693ec6f44752f96e87f9a63b)
This commit is contained in:
parent
8f90d98280
commit
b5e52703e9
2 changed files with 16 additions and 1 deletions
|
@ -1073,7 +1073,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
|
|||
if(cur>0 && eol==cur && (cur<(SEARCHSIZE-2) || ep->prevdirection == -2))
|
||||
#endif /* SHOPT_EDPREDICT */
|
||||
{
|
||||
if(ep->lastdraw==APPEND && ep->prevdirection != -2)
|
||||
if(ep->lastdraw==APPEND)
|
||||
{
|
||||
out[cur] = 0;
|
||||
gencpy((genchar*)lstring+1,out);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue