[code] [textadept] Changes to ui.command_entry

From: Mitchell <m.att.foicica.com>
Date: Sun, 22 Sep 2019 19:22:10 -0400 (EDT)

Hi,

I've just committed a change[1] that simplifies using `ui.command_entry` with different modes.

Previously, to use the command entry with a new mode, you had to define a key mode, call `ui.command_entry.enter_mode()` with that mode, and then from one of the keys in that mode (e.g. the Enter key), call `ui.command_entry.finish_mode()`, passing a function that would be called with the command entry's text. For example:

   keys.my_mode = {
     ['\n'] = function()
       ui.command_entry.finish_mode(ui.print)
     end
   }
   ...
   ui.command_entry.enter_mode('my_mode')

As you can see, it's a bit messy. Instead, you can now do this:

   ui.command_entry.run(ui.print)

If you want to control which key bindings are available from a mode, you can pass them as a second argument:

   ui.command_entry.run(ui.print, {['\t'] = my_tab_completion})

If you had previously defined some custom key bindings for "find incremental", there is a new `ui.find.find_incremental_keys` table of key bindings that you can modify from your *~/.textadept/init.lua*.

Let me know if you have questions, concerns, or issues.

Cheers,
Mitchell

[1]: https://foicica.com/hg/textadept/rev/72ed69e30b27

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sun 22 Sep 2019 - 19:22:10 EDT

This archive was generated by hypermail 2.2.0 : Mon 23 Sep 2019 - 06:32:16 EDT