Re: [code] [textadept] Block comments

From: Mitchell <m.att.foicica.com>
Date: Mon, 20 May 2013 13:01:50 -0400 (EDT)

Richard,

On Mon, 20 May 2013, Richard Philips wrote:

>
>> Thanks for the report and solution. However, toggling block comment for
>> multiple lines does not update the anchor position (beginning of the
>> selection) appropriately. Do you have any ideas there?
>>
>> Cheers,
>> Mitchell
>
> Hi Mitchell,
>
> Let us go for the simple solution :-)
>
> We apply the same trick to the anchor as to the caret,
> but we take the distance from the end of the line (with a twist)
>
> So, before starting the loop:
>
> local p_origin = buffer.length - pos
> local a_origin = buffer.line_end_position[s] - anchor
>
> After the loop, we calculate anchor and pos again:
>
>
> anchor = buffer.line_end_position[s] - a_origin
> -- make anchor stay on the right line in case of uncomment
> if buffer:position_from_line(s) > anchor then
> anchor = buffer:position_from_line(s)
> end
> pos = buffer.length - p_origin

That's great! Committed.

Many thanks,
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 20 May 2013 - 13:01:50 EDT

This archive was generated by hypermail 2.2.0 : Tue 21 May 2013 - 06:42:31 EDT