Re: [textadept] wrong line numbers. textadept-3.5, Linux

From: Robert <ro....at.web.de>
Date: Sat, 11 Dec 2010 14:33:39 +0100

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
Received on Sat 11 Dec 2010 - 08:33:39 EST

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