Re: rox-edit: Fix for 'x lines selected' message

Thomas Leonard <[email protected]> Sun, 3 May 2009 15:02:49 +0100
Newsgroups gmane.comp.desktop.rox.devel
Message-ID <[email protected]>
2009/5/2 Bernard Jungen <[email protected]>:
> On Sat, May 02, 2009 at 12:36:49PM +0100, Thomas Leonard wrote:
>> 2009/5/1 Bernard Jungen <[email protected]>:
>> > On Fri, May 01, 2009 at 07:50:41PM +0100, Thomas Leonard wrote:
>> >> 2009/4/27 Bernard Jungen <[email protected]>:
>> >> > At http://repo.or.cz/w/rox-edit/bju.git?a=commit;h=202e2b1945b81818685925db4ac1e8943a4b6a42
>> >>
>> >> "Number of lines was one too much in some special cases
>> >> Added separate message for the one-line case + French translation"
>> >>
>> >> How can it say one line is selected? If the selection starts and ends
>> >> on the same line then it displays the number of characters instead.
>> >> What are the special cases where it gets it wrong?
>> >
>> > The code says it all. What happens if the newline is selected too? Same number
>> > of characters selected? No. Two lines selected (as was printed)? No.
>> >
>> > The bug is obvious when you're used to select entire lines.
>>
>> Before, if you selected just the newline character, it would say "2
>> lines selected". Now it says "One line selected". Neither is correct,
>> I think.
>
> As long as we talk about partial lines, it is correct IMO. There's no better
> message for that case.
>
>> Perhaps we should display complete lines and extra characters, e.g.
>> "One character selected" in that case, or "35 lines plus 5 characters
>> selected", etc?
>
> Perhaps. But IMO, it's not useful to have that much precision. The number of
> lines gives a rough idea of what is selected, as well as a hint for block
> operations. Talking of block operations, I should have fixed those too. For
> instance, indenting a selection of 2 full lines now indents 3 lines, which is
> obviously incorrect. And here you can't fix it by using character precision!

If the selection goes from the first visible character on the first
line up to and including the last visible character on the second
line, then the selection covers two lines and both get indented.

If you extend the selection by moving over the newline character
following it, the selection now ends on the third line, three lines
are now included in the selection, and indenting indents all three
lines. Notice that to create this selection using the mouse you have
to drag over all three lines.

So, the current behaviour seems correct to me. The behaviour with the
changed message is clearly inconsistent with indenting.

As I understand it, you want to defining a selection as ending on the
line containing the end of the selection, *unless* that's at the start
of a line in which case pretend it ends on the line before. That seems
pretty confusing to me, and would likely require adding special cases
all over the code.


-- 
Dr Thomas Leonard		ROX desktop / Zero Install
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf