Re: [code] [textadept] ui.dialogs

From: Richard Philips <>
Date: Wed, 15 Jan 2014 17:03:38 +0100

Hello Mitchell,

I missed this mail but I replied to a later mail from Robert about this.

> Would a textbox work for you? You could parse by line. I know it's not
> ideal, but it might be less error-prone and more intuitive.

An (editable) textbox is what I use now!

I explain my working method a bit more:

- first I define a snippet with lists the placeholders
   e.g.: (I use the citation example I gave to Robert).
   The snippet is of the form:


      Author :
      Year :

   (You notice no %1, ...)

- I bound CTRL-K to a Lua function of my own.
   This function starts with a textadept.snippets._select()
   and insert the snippet (without snippet placeholders) in my buffer.
   The function continues by taking the inserted text and to present it
   in an editable textbox.
   I fill in the appropriate values
   (In fact, I format the textbox in YAML.
    This gives me an advanced notation for the placeholders. But I
digress :-)
   I parse the text in the textbox and retrieve the placeholders.
   I evaluate the appropriate Lua function with these placeholders as
   The result is a string which replaces the snippet.

This seems complicated (and I assure you, there are things which I even
did not dare to mention here :-) but it works quite well.
If you are interested, I will give an extensive overview of the work I
did (and why I even worked with snippets).
I did this already but it is in Dutch.

> Yes this is not trivial to implement. It also begs some questions.
> Should there be labels next to each inputbox? If so, how should the
> API declare them? How should it return the values from all inputboxes?

A suggestion for the API:


- if option |informative_text is 'not a table' (string), keep the
current functionality

- if option informative_text is a table, present a multiline functionality
   (if it is a table, the option text should be a table as well)
   return selected button or exit code, table with the input text



You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Wed 15 Jan 2014 - 11:03:38 EST

This archive was generated by hypermail 2.2.0 : Thu 16 Jan 2014 - 06:26:42 EST