[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [BUGS?] indenting shift selections

From: Brand Huntsman
Subject: Re: [Nano-devel] [BUGS?] indenting shift selections
Date: Sun, 10 Dec 2017 20:32:43 -0700

On Sun, 10 Dec 2017 12:57:31 +0100
Benno Schulenberg <address@hidden> wrote:

> > The attached patch moves top cursor back when indenting or
> > commenting, but only if top cursor is at the start of the line.  
> Why only the top end of the marked region?  Why not the bottom end?

The bottom cursor was never a problem, no matter which direction the selection 
was made. The indent or comment is placed at the beginning of the line and 
pushed the bottom cursor to the right. But the top cursor was also pushed 
forward and that is what we are trying to fix here.

> I had a simpler patch in mind: to not move the endpoints in the first
> place when they are at x = 0, instead of recompensating them after
> having been compensated.  See attached patch.

Your method is simpler, but neither of your patches for this actually work. Try 
with cursor not on a blank line. Indentation/comment on bottom line was 
selected before, but no longer with your patch.

Preventing the cursor move before it happens would be nice but also adds extra 
branching code to every line which could add up if commenting or indenting a 
huge selection. Those functions are already doing more work than they should be 
doing. They have a conditional branch for every line in the selection, and only 
two lines ever need it. It would be better to remove the cursor code from 
indent_a_line() and comment_line(), and do it only for the top and bottom lines 
directly inside do_*(). Basically the reverse of my patch.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]