bug-readline
[Top][All Lists]
Advanced

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

Re: [Bug-readline] maybe-complete/self-insert


From: Chet Ramey
Subject: Re: [Bug-readline] maybe-complete/self-insert
Date: Wed, 29 Aug 2007 09:11:34 -0400

> #1 In the fileman example code, how do I bind '?' as a special key so
> that when the user type ? (without pressing enter), the menu will be
> printed automatically?

Use one of the readline key binding functions to bind `?' to a function
that will print a newline, display the desired text, and call rl_refresh_line().

> #2 Is there a way to bind the space key as a special key so that
> depending on context, it will either do a self-insert (a space
> character) or do completion (if the cursor is at the end of a word)

Sure.  Look at tcsh_magic_space in the bash code as an example of how to
do something similar.  Use rl_point to find out where you are in
rl_line_buffer.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                                Live Strong.
Chet Ramey, ITS, CWRU    address@hidden    http://tiswww.tis.case.edu/~chet/




reply via email to

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