Re: [code] [textadept] to switch show of line numbering

From: Mitchell <m.att.foicica.com>
Date: Mon, 2 Sep 2013 15:29:55 -0400 (EDT)

Hi,

On Mon, 2 Sep 2013, A.M. Genaev wrote:

> Hi Mitchell,
>
> You code works fine.
>
> May i ask you about some additions?
>
> [snip]
>
> -- line numbering
> line_numbering = false
>
> [snip]
>
> -- to toggle line numbering on and off (Ctrl-_)
> keys['c_'] = function()
> if buffer.margin_width_n[0] > 0 then
> buffer.margin_width_n[0] = 0
> else
> set_buffer_margin_width(line_numbering_width)
> line_numbering = true
> end
> end
>
> It is almost well but line numbering becomes 'on' always when zooming.

You forgot to set `line_numbering = false` in your toggle command.

> And i feel than it may be made simpler.
>
> I would be grateful for any comments.
>

Perhaps it could be made simpler, but it seems to do the job... I myself
would see no need for an auto-sizing line margin. I would just keep
toggleable margin and the width to 2 characters (without dealing with
zoom) if that's what code I primarily deal with.

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 Mon 02 Sep 2013 - 15:29:55 EDT

This archive was generated by hypermail 2.2.0 : Tue 03 Sep 2013 - 06:41:40 EDT