Re: Line number margin not the same in splits as the default view

From: mitchell <mforal.n....at.gmail.com>
Date: Wed, 9 Jun 2010 13:19:34 -0700 (PDT)

Hi Ryan,

On Jun 7, 10:44 am, Ryan Pusztai <rpusz....at.gmail.com> wrote:
> Hi,
>
> I added this to my init.lua file to control some defaults about all themes
> and it has been working great.
>
> -- ~/.textadept/init.lua
>   local function OnBufferNew()
>  local textadept = _G.textadept
> local c = textadept.constants
> local buffer = buffer
>  -- Global tabs and indentation
> buffer.tab_width = 4
> buffer.use_tabs = true
>  buffer.indent = 4
> buffer.indentation_guides = 1
> -- Multiple selection support
>  buffer.multiple_selection = true
> buffer.additional_selection_typing = true
>  buffer.additional_carets_visible = true
> -- Make line number buffer wider (4 digits)
>  buffer.margin_width_n[0] = 4 + 4 * buffer:text_width( c.STYLE_LINENUMBER,
> '9' )
>   end
>
>   textadept.events.add_handler( "buffer_new", OnBufferNew )
> -- end ~/.textadept/init.lua
>
> I am trying to extend the line number margin by one more character than the
> default (up to 4 digits). This works great until you open a split. in the
> split it goes to the default of 3 digits. Any thoughts?
> Does it have to do with the indexing to '0' on "buffer.margin_width_n"? If
> so, how do I make this work all the time?

Put the margin code in another function that handles the 'view_new'
event.

Mitchell

> Thanks.
> --
> Regards,
Received on Wed 09 Jun 2010 - 16:19:34 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:47:32 EST