[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Access to readline completions without line editing
From: |
Chet Ramey |
Subject: |
Re: Access to readline completions without line editing |
Date: |
Mon, 25 Nov 2024 11:59:19 -0500 |
User-agent: |
Mozilla Thunderbird |
On 11/24/24 6:55 PM, matthewktromp@gmail.com wrote:
Chet Ramey <chet.ramey@case.edu> writes:
Here's the format I decided on. My intent is that it's general enough for
applications besides emacs:
/* This implements a protocol to export completions to another process or
calling application via rl_outstream.
MATCHES are the possible completions for TEXT, which is the text between
START and END in rl_line_buffer.
We print:
N - the number of matches
T - the word being completed
S:E - the start and end offsets of T in rl_line_buffer
then each match, one per line
If there are no matches, MATCHES is NULL, N will be 0, and there will be
no output after S:E.
Since MATCHES[0] can be empty if there is no common prefix of the elements
of MATCHES, applications should be prepared to deal with an empty line
preceding the matches.
*/
The bindable function (rl_export_completions) takes the same two arguments
as any other readline function (count, key), and will clear the readline
line buffer if count > 1.
This was inspired by a message sent to me privately; the sender described
the intended use case as:
This was me! Glad to see this landing. Thanks!
I'm glad you spoke up; the changelog entry credits you.
I'll publish my emacs support for this once this has landed with a
stable format.
It's stable.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature