bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-readline] Confused about the behaviour of bind-tty-special-char


From: Chet Ramey
Subject: Re: [Bug-readline] Confused about the behaviour of bind-tty-special-chars
Date: Sat, 03 Sep 2011 14:59:38 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1

On 9/3/11 11:15 AM, Richard Michael wrote:
> Hello everyone,
> 
> MacOS 10.6, macports provided bash 4.2.10(2) compiled against macports
> readline-6.20.
> 
> 
> I've turned off special char binding:
> 
> $ cat ~/.inputrc
> set bind-tty-special-chars off
> 
> $  bind -v | grep special-chars
> set bind-tty-special-chars off
> 
> 
> However, readline still binds functions for \C-u, \C-w and other tty
> keyseqs (such as HOME, END).
> 
> $ bind -p | grep '\C-[uw]'
> "\C-u": unix-line-discard
> "\C-w": unix-word-rubout
> 
> $ bind -q beginning-of-line
> beginning-of-line can be invoked via "\eOH", "\e[H".
> 
> 
> Why?  After turning off the special char binding, I expected to see
> these keyseqs as self-inserting and the functions as unbound.

Those are the default readline key bindings.  The defaults exist
regardless of whether or not readline takes the extra step to make
sure the tty special chars are bound to their readline equivalents.
The bind-tty-special-chars variable caters mostly to those who bind
their tty special characters to values other than the defaults.

> (Aside, "bind -u .. ", ex. "bind -u beginning-of-line", does not
> unbind these functions.  Is that related?)

It works, at least for unix-word-rubout (but see below):

$ echo $BASH_VERSION
4.2.10(2)-maint
$ bind 'set bind-tty-special-chars off'
$ bind -p | grep unix-word-rubout
"\C-w": unix-word-rubout
$ bind -u unix-word-rubout
$ bind -p | grep unix-word-rubout
# unix-word-rubout (not bound)

However, readline binds functions to the arrow and keypad keys on each
invocation.  There's not currently any way to turn that off.
`bind -u beginning-of-line' will remove the default binding to ^A, but
leave the arrow key bindings intact.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]