Hi Julian

(from memory:)

You can use the callback interface (section 2.4.12 of the readline info)
within a select() loop that watches both stdin and the source of your
asynchronous information.

When select() returns with stdin readable, you just call
rl_callback_read_char()
When it returns with your other descriptor readable, you can read, and
display the information as you see fit (possibly using rl_message)

If you moved the cursor you'll have to move it back to its original place,
possibly with some "low level terminal interaction"  If you messed up the
screen, you may have to call rl_redisplay()

I think this is about all there is to it.

Hans

2009/10/4 Julian Scheid <[email protected]>

> I am working on a command line application with an input loop driven
> by readline. The application can receive information asynchronously
> (not in direct response to commands entered via stdin) and I would
> like to display this information instantly while preserving the prompt
> and any text entered by the user on the prompt so far - just like
> <TAB><TAB> in bash will "push down" the prompt when printing available
> completions. Is this possible and if so, how can I achieve this
> without resorting to low-level terminal interaction?
>
> I have read about rl_save_prompt() and rl_restore_prompt() as well as
> rl_crlf() but it is unclear to me how I can clear the currently
> displayed prompt, especially if the prompt spans multiple screen rows.
>
>
_______________________________________________
Bug-readline mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-readline

Reply via email to