diff options
author | 2017-11-22 12:17:34 +0000 | |
---|---|---|
committer | 2017-11-22 12:17:34 +0000 | |
commit | 4eb89ea453a1cbe154fde84480346e961ef4dc0a (patch) | |
tree | 211baff070948d1bd54862a59ed2f758f0bac32e | |
parent | Add tests for emacs editing mode in ksh. While here, improve the output on test (diff) | |
download | wireguard-openbsd-4eb89ea453a1cbe154fde84480346e961ef4dc0a.tar.xz wireguard-openbsd-4eb89ea453a1cbe154fde84480346e961ef4dc0a.zip |
Fix some incorrectness related to Emacs editing mode in ksh:
- Keep the order of bindings in sync between the manual and implementation
- Fix wrongly documented bindings in the manual
- Break out commands without a default binding in the manual
ok jmc@ tb@
-rw-r--r-- | bin/ksh/emacs.c | 6 | ||||
-rw-r--r-- | bin/ksh/ksh.1 | 22 |
2 files changed, 17 insertions, 11 deletions
diff --git a/bin/ksh/emacs.c b/bin/ksh/emacs.c index 4da667bc6be..86caa1b87c4 100644 --- a/bin/ksh/emacs.c +++ b/bin/ksh/emacs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: emacs.c,v 1.73 2017/08/30 17:02:53 jca Exp $ */ +/* $OpenBSD: emacs.c,v 1.74 2017/11/22 12:17:34 anton Exp $ */ /* * Emacs-like command line editing and history @@ -1472,6 +1472,7 @@ x_init_emacs(void) kb_add(x_del_back, NULL, CTRL('?'), 0); kb_add(x_del_back, NULL, CTRL('H'), 0); kb_add(x_del_char, NULL, CTRL('['), '[', '3', '~', 0); /* delete */ + kb_add(x_del_bword, NULL, CTRL('W'), 0); kb_add(x_del_bword, NULL, CTRL('['), CTRL('?'), 0); kb_add(x_del_bword, NULL, CTRL('['), CTRL('H'), 0); kb_add(x_del_bword, NULL, CTRL('['), 'h', 0); @@ -1493,7 +1494,6 @@ x_init_emacs(void) kb_add(x_mv_fword, NULL, CTRL('['), 'f', 0); kb_add(x_goto_hist, NULL, CTRL('['), 'g', 0); /* kill-line */ - kb_add(x_del_bword, NULL, CTRL('W'), 0); /* not what man says */ kb_add(x_kill, NULL, CTRL('K'), 0); kb_add(x_enumerate, NULL, CTRL('['), '?', 0); kb_add(x_list_comm, NULL, CTRL('X'), '?', 0); @@ -1505,6 +1505,7 @@ x_init_emacs(void) kb_add(x_prev_histword, NULL, CTRL('['), '.', 0); kb_add(x_prev_histword, NULL, CTRL('['), '_', 0); /* how to handle: quote: ^^ */ + kb_add(x_literal, NULL, CTRL('^'), 0); kb_add(x_draw_line, NULL, CTRL('L'), 0); kb_add(x_search_char_back, NULL, CTRL('['), CTRL(']'), 0); kb_add(x_search_char_forw, NULL, CTRL(']'), 0); @@ -1516,7 +1517,6 @@ x_init_emacs(void) kb_add(x_fold_upper, NULL, CTRL('['), 'U', 0); kb_add(x_fold_upper, NULL, CTRL('['), 'u', 0); kb_add(x_literal, NULL, CTRL('V'), 0); - kb_add(x_literal, NULL, CTRL('^'), 0); kb_add(x_yank, NULL, CTRL('Y'), 0); kb_add(x_meta_yank, NULL, CTRL('['), 'y', 0); /* man page ends here */ diff --git a/bin/ksh/ksh.1 b/bin/ksh/ksh.1 index 4471043038f..812384b2ec4 100644 --- a/bin/ksh/ksh.1 +++ b/bin/ksh/ksh.1 @@ -1,8 +1,8 @@ -.\" $OpenBSD: ksh.1,v 1.195 2017/08/30 17:08:45 jca Exp $ +.\" $OpenBSD: ksh.1,v 1.196 2017/11/22 12:17:34 anton Exp $ .\" .\" Public Domain .\" -.Dd $Mdocdate: August 30 2017 $ +.Dd $Mdocdate: November 22 2017 $ .Dt KSH 1 .Os .Sh NAME @@ -4656,7 +4656,7 @@ Simply causes the character to appear as literal input. Most ordinary characters are bound to this. .It Xo backward-char: .Op Ar n -.No ^B , ^XD +.No ^B , ^X^D .Xc Moves the cursor backward .Ar n @@ -4749,7 +4749,7 @@ Deletes characters after the cursor. .It Xo delete-word-backward: .Op Ar n -.No ERASE , ^[^? , ^[^H , ^[h +.No WERASE , ^[ERASE , ^W, ^[^? , ^[^H , ^[h .Xc Deletes .Ar n @@ -4758,9 +4758,9 @@ words before the cursor. .Op Ar n .No ^[d .Xc -Deletes characters after the cursor up to the end of +Deletes .Ar n -words. +words after the cursor. .It Xo down-history: .Op Ar n .No ^N , ^XB @@ -4830,8 +4830,6 @@ Goes to history number .Ar n . .It kill-line: KILL Deletes the entire input line. -.It kill-region: ^W -Deletes the input between the cursor and the mark. .It Xo kill-to-eol: .Op Ar n .No ^K @@ -4938,6 +4936,14 @@ Immediately after a .Ic yank , replaces the inserted text string with the next previously killed text string. .El +.Pp +The following editing commands lack default bindings but can be used with the +.Ic bind +command: +.Bl -tag -width Ds +.It kill-region +Deletes the input between the cursor and the mark. +.El .Ss Vi editing mode The vi command-line editor in .Nm |