[code] Re: [textadept] Feature request: Elastic tabstops

From: Joshua Krämer <joshua.kraemer.att.gmail.com>
Date: Fri, 20 Mar 2015 13:37:14 +0100

On 2015-02-17, 10:52, Mitchell wrote:

> > The reset function recalculates the tabstops in a given text area.
> > Is it possible to run this reset function whenever a change in a
> > buffer occurs on the changed area? I could not find a
> > corresponding event.
>
> There is no way to determine this information. The argument passed to
> `events.UPDATE_UI` will let you know if the content itself changes,
> but not what that content was.

Because the changed content cannot be determined, I decided to
recalculate all tabstops in the visible area whenever UPDATE_UI is
omitted (except selection changes) or the buffer is switched.

To try it out, copy the attached file lua.init to
~/.textadept/modules/elastic_tabstops/

Then add the following to ~/.textadept/init.lua:

events.connect('update_ui', function(updated)
        _M.elastic_tabstops.reset_visible(updated)
end)

events.connect('buffer_after_switch', function()
        _M.elastic_tabstops.reset_visible(1)
end)

Kind regards,
Joshua

-- 
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 Fri 20 Mar 2015 - 08:37:14 EDT

This archive was generated by hypermail 2.2.0 : Sat 21 Mar 2015 - 06:29:43 EDT