Re: [code] [textadept] FR: Select Snippet to auto-OK

From: Mitchell <>
Date: Fri, 19 Jun 2020 10:29:01 -0400 (EDT)

Hi Lukas,

On Fri, 19 Jun 2020, Procházka Lukáš Ing. wrote:

> Hi Mitchell,
> On Fri, 19 Jun 2020 15:29:14 +0200, Mitchell <> wrote:
>> Hi Lukas,
>> On Fri, 19 Jun 2020, Procházka Lukáš Ing. wrote:
>>> Hi Michell,
>>> would it be possible to add such a feature to "Select Snippet" dialog that
>>> the dialog performs "OK" once there is just one snippet which meets the
>>> trigger typed in the edit box in the top?
>>> - This would work almost like key chains, with possibility to see what
>>> text
>>> is to be "sent" to the editor.
>>> (So unlike key-chains - user doesn't need to keep in mind key chains which
>>> are not used so frequently - he can see them in the "Select Snippet"
>>> dialog.)
>>> - Also it might depend on a option switch, maybe in the dialog - see the
>>> pic.
>> Do you mean that you start with a list of snippets, start typing to filter,
>> and then once there is only one option available, immediately insert it?
> yes, that's what I mean.
>> If so, that is not possible, and probably not desirable in case you make a
>> typo and wind up with something completely unexpected.
> yes, I'm aware of that user may make a typo - but still there is "undo" and
> also - that's why suggested the check box with option to "apply once there is
> just one item in the listbox".
> BTW, which function is called on "OK" in "Select Snippet" dialog - which
> performs inserting the text selected as "snippet text" into the current
> buffer?

Well, the dialog code is part of gtDialog[1], which is a C application/library, so pressing a button causes the dialog to return a value that is consumed by ``. That value (the snippet text) is passed to `textadept.snippets.insert()`. There is no way to programatically interact with the dialog (e.g. see how many items are visible, click "Ok", etc.). I hope I'm answering your question.

By the way, those are the functions starting in Textadept 11. Textadept 10 uses `textadept.snippets._select()` and `textadept.snippets._insert()`.



You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Fri 19 Jun 2020 - 10:29:01 EDT

This archive was generated by hypermail 2.2.0 : Sat 20 Jun 2020 - 06:26:54 EDT