Re: [code] [Textadept] command_entry events

From: Mitchell <>
Date: Sun, 26 Jan 2020 21:49:18 -0500 (EST)

Hi Sam,

On Sun, 26 Jan 2020, samg wrote:

> Hello,
> Does the command entry buffer not emit the CHAR_ADDED event? Or is my
> code below flawed? If there's no event, is there another way to get the input?
> The only way I can think of other than events is to rebind every character and
> number in mode_keys. I'm running Textadept 10.8 on Linux.
> [snip]

The command entry does not emit `events.CHAR_ADDED` events. Instead, you'll want your mode keys to have a metatable with an `__index` metamethod that handles keypresses. For example:

   local function finished(text)
     -- Function to run when Enter is pressed.
     -- text contains the command entry text.

   local mode = setmetatable({
     -- Special keys to handle go here like cut, copy, paste, etc.
   }, {__index = function(_, k)
     -- Arbitrary keys to handle go here.
     -- k is the string representation of the key pressed.
     -- e.g. Ctrl+Alt+A would give 'ca'.
     -- Do something with k.
     ui.statusbar_text = 'key pressed: '..k
   end}), mode)


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sun 26 Jan 2020 - 21:49:18 EST

This archive was generated by hypermail 2.2.0 : Mon 27 Jan 2020 - 06:51:11 EST