Hi,

Alexander Hall wrote on Tue, Aug 09, 2016 at 12:03:39PM +0200:
> On Mon, Aug 08, 2016 at 07:12:34PM +0200, Ingo Schwarze wrote:

>> The search-history description does not say anything that the escape
>> key could be used to leave search mode, nor do i see such a statement
>> anywhere else; instead, the search-history description goes on as
>> follows:

> However, we explicitly *do* use escape to exit the search mode already,
> regardless of whether said escape is part of an "other command" or not,
> so we're not entirely true to the man page there either.

Regarding emacs incremental search (^R) mode the ksh(1) manual

 1. says that commands make the shell leave search mode
 2. does not explicitly say what happens when you type an isolated
    escape character

My patch fixed 1 and changed 2 only in a way that isn't worse than
what we had before and i got two OKs, so i committed it.

Besides, ksh emacs mode implements the concept of "prefix characters",
which is barely documented and hard to search for in the manual page
because the word "prefix" is also used for several other, unrelated
concepts.  The concept of "prefix characters" appears explicitly at
two places:

  bind string=[editing-command] ...
    The specified editing command is bound to the given string, which
    should consist of a control character optionally preceded by one
    of the two prefix characters.

  emacs-usemeta
    In emacs command-line editing, use the 8th bit as meta (^[) prefix.
    This is the default.

And implicitly at one other place:

  error:
    Error (ring the bell).

I think the manual intends to imply that a command prefix character
followed by something that does not resolve to a command is an error,
so what i committed actually does the right thing for case 2 above, too.

But let's make this clearer in the manual, OK?

 - The first sentence that i'm removing ("which should consist")
   spreads fuzzy, non-mandatory advice before (worse, instead of)
   explaining how things actually work.
 - Improve the wording in the sentence about caret notation
   and append it to the paragraph it actually belongs to.
 - Drop the sentence "Multi-character sequences are supported"
   (for what?) because that becomes clear anyway in the new text
   right afterwards.

Yours
  Ingo


Index: ksh.1
===================================================================
RCS file: /cvs/src/bin/ksh/ksh.1,v
retrieving revision 1.179
diff -u -r1.179 ksh.1
--- ksh.1       27 Apr 2016 12:46:23 -0000      1.179
+++ ksh.1       9 Aug 2016 12:05:23 -0000
@@ -2809,9 +2809,7 @@
 .Ar ...
 .Xc
 The specified editing command is bound to the given
-.Ar string ,
-which should consist of a control character
-optionally preceded by one of the two prefix characters.
+.Ar string .
 Future input of the
 .Ar string
 will cause the editing command to be immediately invoked.
@@ -2822,10 +2820,23 @@
 will afterwards be immediately replaced by the given
 .Ar substitute
 string, which may contain editing commands.
+Control characters may be written using caret notation.
+For example, ^X represents Control-X.
 .Pp
-Control characters may be written using caret notation
-i.e. ^X represents Control-X.
-Multi-character sequences are supported.
+If a certain character occurs as the first character of any bound
+multi-character
+.Ar string
+sequence, that character becomes a command prefix character.
+Any character sequence that starts with a command prefix character
+but that is not bound to a command or substitute
+is implicitly considered as bound to the
+.Sq error
+command.
+By default, two command prefix characters exist:
+Escape
+.Pq ^[
+and Control-X
+.Pq ^X .
 .Pp
 The following default bindings show how the arrow keys
 on an ANSI terminal or xterm are bound

Reply via email to