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

From: mitchell <c....at.caladbolg.net>
Date: Sun, 12 Dec 2010 21:42:48 -0500 (EST)

Hi Leo,

On Sun, 12 Dec 2010, Leo wrote:

> 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.

You can also just change your theme to read

-- Line Number Margin.
buffer.margin_width_n[0] = 4 + 4 *
   buffer:text_width(c.STYLE_LINENUMBER, '9')

so all buffers have a width of 4 by default.

I rarely worked with buffers over 1000 lines so the default was 3 (to
maximize screen real-estate) and has been the case ever since.

mitchell

>
> --Leo--
>
> --
> You received this message because you are subscribed to the Google Groups "textadept" group.
> To post to this group, send email to textadept.at.googlegroups.com.
> To unsubscribe from this group, send email to textadept+unsubscribe.at.googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/textadept?hl=en.
>
>

mitchell
Received on Sun 12 Dec 2010 - 21:42:48 EST

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