Re: wrong line numbers. textadept-3.5, Linux

From: Leo <slonik....at.gmail.com>
Date: Sun, 12 Dec 2010 05:30:49 -0800 (PST)

On Dec 11, 8:33 am, Robert <ro....at.web.de> wrote:
> Hi Leo,
>
> On Sat, Dec 11, 2010 at 1:04 PM, Leo <slonik....at.gmail.com> wrote:
> > Hi List,
> > I downloaded textadept_3.5.tgz and ran a compiled texadept executable
> > on my Ubuntu-9.4 machine. Everything looks fine except for line
> > numbers. In the left margin there is only room for 3 digits. As a
> > result of it, line number 1002 is shown as 002 and so on.
>
> > Is it a problem with my environment or with textadept?
>
> > --Leo--
>
> three digits is a default value in Textadept's themes.
> You could add this to your init.lua:
>
> events.connect('buffer_after_switch',
>   function()
>     local buffer = buffer
>     local c = _SCINTILLA.constants
>     -- set margin for files with more than 1000 lines
>     local width = #(buffer.line_count..'')
>     width = width > 3 and width or 3
>     buffer.margin_width_n[0] = 4 + width *
>       buffer:text_width(c.STYLE_LINENUMBER, '9')
>   end
> )
>
> It will change the margin width after switching to a buffer with more
> than 1000 lines.
>
> Robert

Robert,
thanks! It works! BTW, should it be a default behavior? Incorrect line
numbers can be a real bitch when debugging or communicating with other
developers.

--Leo--
Received on Sun 12 Dec 2010 - 08:30:49 EST

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