mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 11:42:21 +00:00
Fix the Alt+D and Alt+H keyboard shortcuts in emacs mode (#178)
This commit fixes the functionality of Alt+D and Alt+H in emacs mode.
These keyboard shortcuts are intended to work on whole words, but
after commit 13c3fb21
their functionality was reduced to deleting only
singular letters:
$ Test word <Alt+H> # This should delete 'word', not just 'd'.
$ Foo <Alt+B> <Alt+D> # This should delete 'Foo', not just 'F'.
Man page entries for reference:
M-d Delete current word.
M-^H (Meta-backspace) Delete previous word.
M-h Delete previous word.
src/cmd/ksh93/edit/emacs.c:
- 'count' cannot be overridden when handling Alt+D or Alt+H,
so add the total number of repetitions to count (the number of
repetitions can't be negative).
- If 'count' is a negative number, set it to one before adding the
number of repetitions.
This commit is contained in:
parent
24598fed7c
commit
29b11bba3a
2 changed files with 8 additions and 5 deletions
3
NEWS
3
NEWS
|
@ -5,6 +5,9 @@ Any uppercase BUG_* names are modernish shell bug IDs.
|
||||||
|
|
||||||
2021-02-15:
|
2021-02-15:
|
||||||
|
|
||||||
|
- Fixed a bug in the emacs built-in editor, introduced on 2020-09-17, that
|
||||||
|
made the Meta-D and Meta-H keys delete single characters instead of words.
|
||||||
|
|
||||||
- A new 'backslashctrl' shell option has been added. It is on by default.
|
- A new 'backslashctrl' shell option has been added. It is on by default.
|
||||||
Turning it off (set +o backslashctrl or set --nobackslashctrl) disables the
|
Turning it off (set +o backslashctrl or set --nobackslashctrl) disables the
|
||||||
special escaping behaviour of the backslash character in the emacs and vi
|
special escaping behaviour of the backslash character in the emacs and vi
|
||||||
|
|
|
@ -318,13 +318,13 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit)
|
||||||
killing = 0;
|
killing = 0;
|
||||||
#endif
|
#endif
|
||||||
oadjust = count = adjust;
|
oadjust = count = adjust;
|
||||||
if(vt220_save_repeat)
|
|
||||||
{
|
|
||||||
count = vt220_save_repeat;
|
|
||||||
vt220_save_repeat = 0;
|
|
||||||
}
|
|
||||||
if(count<0)
|
if(count<0)
|
||||||
count = 1;
|
count = 1;
|
||||||
|
if(vt220_save_repeat>0)
|
||||||
|
{
|
||||||
|
count += vt220_save_repeat;
|
||||||
|
vt220_save_repeat = 0;
|
||||||
|
}
|
||||||
adjust = -1;
|
adjust = -1;
|
||||||
i = cur;
|
i = cur;
|
||||||
if(c!='\t' && c!=ESC && !digit(c))
|
if(c!='\t' && c!=ESC && !digit(c))
|
||||||
|
|
Loading…
Reference in a new issue