On 10/13/24 8:25 AM, Basile STARYNKEVITCH wrote:
Hello from France.

This is related to the RefPerSys <http://refpersys.org/> open source inference engine (GPLv3+) project on github <https://github.com/RefPerSys/ RefPerSys/> developed on Linux/Debian/x86-64/trixie.

Is there some GNU readline-8.2 API to preset the buffer?

Yes. You set the variable

rl_startup_hook

to the address of a function that inserts the desired text into the
line using rl_insert_text().

You could potentially use the same startup hook throughout your program,
keep the preset text in a global or file-scope variable, and have the
function insert it whenever it's called (or, if it's a null string, don't
insert anything). Then you can modify the text whenever you like.

This is how the bash read builtin's -i option works. Look at
builtins/read.def:set_itext().

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to