Re: [code] [textadept] Don't show line numbers

From: Mitchell <m.att.foicica.com>
Date: Sat, 1 Jun 2019 19:28:40 -0400 (EDT)

Hi Lukas,

On Sun, 2 Jun 2019, Procházka Lukáš Ing. wrote:

> Hello,
>
> I have 3 views in TA.
>
> I'd would like to NOT DISPLAY line numbers for all of them. (It's more
> complicated in real case, but let's have a minimalistic sample.)
>
> I placed the code into 'events.INITIALIZED' handler:
>
> ---- init.lua
> events.connect(events.INITIALIZED, function(...)
> for _, view in ipairs(_VIEWS) do
> local buf = view.buffer
>
> buf.margin_width_n[0] = 0 -- Don't display line numbers
> end
>
> for _, buf in ipairs(_BUFFERS) do
> buf.margin_width_n[0] = 0 -- Don't display line numbers
> end
> end)
> ----
>
> But the code removes line numbers in ony ONE view... What am I doing wrong?

Try this:

   events.connect(events.VIEW_NEW, function()
     buffer.margin_width_n[0] = 0
   end)

`events.INITIALIZED` only occurs when Textadept initially starts up, when a single view is available. Textadept's session functionality then creates more views from a saved session, but that is after your event handler is run. You want your setting to apply to all subsequent views right?

I'd like to point out that normally a setting like `buffer.margin_width_n[0] = 0` in your *~/.textadept/init.lua* would be sufficient, but for line margins in particular, Textadept automatically sets their width based on a file's line number.

Cheers,
Mitchell

-- 
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 Sat 01 Jun 2019 - 19:28:40 EDT

This archive was generated by hypermail 2.2.0 : Sun 02 Jun 2019 - 06:40:09 EDT