bug-readline
[Top][All Lists]
Advanced

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

Re: [Bug-readline] rl_bind_keyseq family functions don't create bindings


From: Chet Ramey
Subject: Re: [Bug-readline] rl_bind_keyseq family functions don't create bindings in some cases
Date: Sat, 03 Jan 2015 15:01:19 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 1/3/15 1:53 PM, Mark Karpov wrote:
> 
> Found in Readline 6.3-release. ASUS K52D laptop, Arch Linux x86_64,
> Linux 3.17.6-1 kernel.
> 
> According to description of rl_bind_keyseq (also rl_bind_keyseq_in_map,
> rl_bind_keyseq_if_unbound, rl_bind_keyseq_if_unbound_in_map), this
> function should create new keymap entries as necessary (actually "new
> keymaps" in description, but I think "new keymap entries" is
> meant). It doesn't work this way.

It actually does.  First, the language in the documentation is intended;
non-trivial key sequences are implemented by using keymaps bound to non-
null key sequence prefixes, so binding "abc" to a readline function will
create a new keymap bound to "a" and another bound to "b".  The dispatch
code understands how to follow the chain of keymaps.

Second, the "C-q" sequence is bound by default the same as C-a (to
rl_quoted_insert), so the non-existent key sequence supposition isn't
correct.

The reason it's not working as you intend is that readline binds stty
special characters to their readline equivalents and tries to leave any
terminal XON/XOFF settings alone.  On my system, at least, ^Q is the
default tty restart-output character, so if `ixon' is enabled in the
terminal's settings, read(2) won't even return ^Q.

If you want to try it with a key sequence that's not bound by default,
try ^O, but make sure that's not your terminal's default `discard' (maybe
`flush') character.  If you want to try the code without changing it, and
^Q is your terminal's `start' character, run `stty -ixon' first.

-- 
``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]