PreviousNextTracker indexSee it online !

(50/231) 1869411 - Clicking text area inserts spaces in rect-selecetion mode

Bug 932534 is as follows:

When in normal selection mode, clicking beyond the end of the line puts the cursor at the end of the line. Fine.

However, in rectangular selection mode, it actually inserts whitespace into the document until it reaches the mouse cursor, and puts the cursor there.

If you have to drag the cursor to make this happen, then I would understand.

This bug was closed because "it's a feature." However, it's very annoying for me so if it's a feature, please make it optional. Rectangular selection is generally more useful for me than line selection, so I usually have it turned on. Therefore I see this problem all the time.

It's a problem because I end up with all kinds of modified buffers even though I didn't deliberately modify most of them. For example, log files. Clicking on a text area should NEVER modify any text.

If it was "virtual space" instead of actually modifying the document, that would be fine.

Submitted rhvj43 - 2008-01-11 - 15:57:20z Assigned nobody
Priority 5 Category text area and syntax packages
Status Open Group normal bug
Resolution None Visibility No


2008-01-12 - 11:44:21z
Logged In: YES
Originator: NO

(Changed the summary to tell the summary of the bug.)

This could be a feature because it was explicitly coded to do so. (FYI,
the code is in doSingleClick() of TextAreaMouseHandler.) But I agree
that modifying the text by just clicking text area is surprising behavior.

Can it be a solution for you to defer insertion of spaces until start of
dragging? This can be a more easy solution comparing to implement the
"virtual space" feature.
2008-01-12 - 12:51:17z
Logged In: YES
Originator: NO

Good Proposal!
2008-01-14 - 15:26:19z
Logged In: YES
Originator: YES

I started studying this a little more and noticed some other weirdness.

I'm thinking that the added whitespace is useless while selecting, but might be important while pasting. However, even with the extra space it doesn't quite paste correctly. If something is selected, even one character, it pastes the rectangle fine. If nothing is selected, it puts the first line where it should go but the other lines start on column 1.

Maybe the true fix for this is to not insert the spaces (get rid of that code), and change the code for pasting a rectangle to always work the "right" way, i.e. as if something is selected.

If it turns out that the extra whitespace is really needed for pasting, wait until the paste is done before inserting the whitespace.

I haven't looked at the source code yet, but I'm sure it would help me get to the bottom of this :)