Page MenuHomeFeedback Tracker

Backward selection (hold click and drag to the left) doesn't move the view in CT_EDIT controls
Feedback, NormalPublic

Description

As you know, if you put a long text in CT_EDIT (RscEdit) with ST_LEFT and move the caret to the right so that it falls outside the control size, the "view" changes to show the caret.

But now if you try a backward selection (hold click and drag to the left) to go back to the beginning of the text, the view doesn't change and the caret doesn't move any further backwards than the current view.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 7
Category
Scripting
Steps To Reproduce
  1. Create a control with CT_EDIT and ST_LEFT, and put a long text in it;
_ctrl = (findDisplay 46 createDisplay "RscDisplayEmpty") ctrlCreate ["RscEdit", -1];
_ctrl  ctrlSetText "But now if you try a backward selection (hold click and drag to the left) to go back to the beginning of the text, the view doesn't change and the caret doesn't move any further backwards than the current view.";
_ctrl ctrlSetTextSelection [1e3,0];
  1. Now try to make a backward selection by hold-clicking on the text and dragging the mouse to the left.
  2. As you can see, the caret doesn't move outside the current view.
  3. Now try the Shift+Left Arrow backward selection via keyboard. Notice that this one works.

Event Timeline

dedmen added a subscriber: dedmen.Feb 1 2021, 4:52 PM

Do you know if that is new? As I recently touched exactly that code.

Do you know if that is new? As I recently touched exactly that code.

No. It's always been like this (afaik)

Hold and drag to right, only works because your mouse is selecting in the middle of the last character, so it selects the last and thus moves a bit and because the left side always starts with a full character (not half a character or smth) the view gets moved a little 1 char, letting you select half way into the next character again.

But as the left side always starts with a full char, you cannot go further left to select the next half char and trigger a move.

[public] Fixed CEdit Mouse selection not able to select text that is on the left outside of view area

omg please give me a better changelog entry

[public] Fixed CEdit Mouse selection not able to select text that is on the left outside of view area

omg please give me a better changelog entry

LoL I don't think there's a pretty way to say this!

How about:
Fixed CT_Edit leftward mouse selection not selecting text outside of view area

dedmen changed the task status from New to Feedback.Feb 9 2021, 12:42 PM
Leopard20 added a comment.EditedFeb 13 2021, 1:38 AM

@dedmen
Not fully fixed. If the control is in a controlsGroup, it doesn't work properly, it uses the position of its controlsGroup parent, instead of its own absolute position.
In other words, to do the backward selection you have to move the mouse all the way outside of the controls group for it to work (forward selection works fine though):

_disp = findDisplay 46 createDisplay "RscDisplayEmpty";
_grp = _disp ctrlCreate ["RscControlsGroup", -1];
_grp ctrlSetPosition [safeZoneX+0.2*safeZoneW, safeZoneY + 0.2 * safeZoneH, 0.6 * safeZoneW, 0.6 * safeZoneH];
_grp ctrlCommit 0;

_back = _disp ctrlCreate ["RscText", -1, _grp];
_back ctrlSetPosition [0, 0, 0.6 * safeZoneW, 0.6 * safeZoneH];
_back ctrlCommit 0;
_back ctrlSetBackgroundColor [0,0,0,0.1];
_back ctrlSetText "";
_back ctrlSetTextColor [0,0,0,0];

_ctrl = _disp ctrlCreate ["RscEdit", -1, _grp];
_ctrl ctrlSetPosition [0.2*safeZoneW, 0.3 * safeZoneH - 0.025, 0.2 * safeZoneW, 0.05];
_ctrl ctrlCommit 0;
_ctrl  ctrlSetText "But now if you try a backward selection (hold click and drag to the left) to go back to the beginning of the text, the view doesn't change and the caret doesn't move any further backwards than the current view.";
_ctrl ctrlSetTextSelection [1e3,0];

The black area represents the controlsGroup.