At 2025-07-09T22:59:51+0200, Vincent Lefevre wrote:
> On 2025-07-09 14:13:59 -0400, Chet Ramey wrote:
> > On 7/9/25 12:21 PM, Vincent Lefevre wrote:
> > > So, this should be the equivalent of the kill character, i.e.
> > > "erase the current line", which corresponds to kill-whole-line
> > > ("Kill all characters on the current line, no matter where
> > > point is"), but this is not what I get.
> >
> > It isn't, though. The readline equivalent of the stty VKILL
> > character is `unix-line-discard', which kills characters between
> > point and the beginning of the line. (That happens to be the default
> > binding for ^U in both emacs and vi modes).
>
> The intent of the KILL character ("kill" in stty) is to erase the
> line, as clearly documented in the stty(1) man page:
>
> kill CHAR
> CHAR will erase the current line
I was going to argue with Vincent here in support of Chet, but checking
a couple of sources, it's hard to do that.
POSIX Issue 8 (2024) draft 4.1 says "[t]he KILL character shall delete
all data in the current line, if there is any." (§ 11.1.6, "Canonical
Input Mode Processing, p. 202, line 7238)
Stevens/Rago's _Advanced Programming the Unix Environment_ (Third
Edition, 2013) says: "The kill character. ... It erases the entire line
and is discarded when processed (i.e., it is not passed to the
process)." (§18.3, p. 681)
On a terminal device that doesn't permit the placement of the input
position ("cursor") anywhere except at the "end"[1] of the input buffer,
there is no difference between Vincent and Chet's interpretations. I
leave as an exercise for the reader whether the V7/BSD terminal
interface ("sgttyb"?) or System V/POSIX one ("termios") admitted a
distinction. Sources for both are publicly available.
Personally, I like Bash's behavior. I often want to kill to the
beginning of the line while leaving everything after the cursor position
("point" in Emacs/readline-speak) intact. If I really want to fully
abort a command line in progress, my habit is simply to use Control+C.
The aborted command doesn't go into history but it's in my terminal's
scrollback buffer in case I need to see it while making another attempt.
It Teletype Model 37 days, my habits would have been wasteful of ink and
paper. But I don't use paper terminals.
> [*] In practice, there would probably be no differences, but for
> the KILL character, there would be 2 variants: some users might
> prefer unix-line-discard and others might prefer kill-whole-line.
> That would be at least one reason why the inputrc file having the
> precedence would be important.
It may be that unix-line-discard has desirable behavior but a badly
misleading name.
Regards,
Branden
[1] not the "sizeof" the input buffer but the last valid position in it,
after which any further data is ignored
signature.asc
Description: PGP signature
