mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
emacs: fix keys w/ repeat parameters repeating extra (re: 29b11bba)
@JohnoKing writes:
> In emacs mode, using Alt+D or Alt+H with a repeat parameter
> results in the deletion of extra characters. Reproducer:
>
> $ set -o emacs
> $ foo bar delete add # <Ctrl+A> <ESC+3+Alt+D>
> $ d # Should be ' add'
>
> $ foo bar delete add # <ESC+3+Alt+H>
> $ f # Should be 'foo '
>
> [...] this bug also affects the Delete and Arrow keys [...].
> Reproducer:
>
> $ test_string <Ctrl+A> <ESC+3+Delete>
> # This will delete all of 'test', which is four characters
> $ test_string <Ctrl+A> <ESC+4+Right Arrow>
> # This should move the cursor to '_', not 's'
src/cmd/ksh93/edit/emacs.c: ed_emacsread():
- Revert part of 29b11bba: once again set 'count' to
'vt220_save_repeat' instead of adding the value.
- do_escape: If the escape() function (which handles both ESC
repeat counts and commands like ESC d and ESC h) returns a repeat
count, do not use the saved repeat count for v220 sequences.
src/cmd/ksh93/tests/pty.sh:
- Test the four reproducers above.
Fixes: https://github.com/ksh93/ksh/issues/292
This commit is contained in:
parent
da4bf85f27
commit
143ff27a91
2 changed files with 23 additions and 1 deletions
|
|
@ -324,7 +324,7 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit)
|
|||
count = 1;
|
||||
if(vt220_save_repeat>0)
|
||||
{
|
||||
count += vt220_save_repeat;
|
||||
count = vt220_save_repeat;
|
||||
vt220_save_repeat = 0;
|
||||
}
|
||||
adjust = -1;
|
||||
|
|
@ -623,6 +623,8 @@ update:
|
|||
vt220_save_repeat = oadjust;
|
||||
do_escape:
|
||||
adjust = escape(ep,out,oadjust);
|
||||
if(adjust > -1)
|
||||
vt220_save_repeat = 0;
|
||||
continue;
|
||||
case cntl('R') :
|
||||
search(ep,out,count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue