Selecting text in a field with the mouse works from left to right. From right to left the selection does not grow: the caret just follows the mouse to the left.
Cause
TextField keeps the selection as anchor (selStart) and focus (selEnd) and pushes it into the hidden <input> of the KeyboardBridge. The bridge set the range ordered (lo, hi) and without a direction. The browser answers with a selectionchange, and the bridge reported selectionStart/selectionEnd back, again ordered. After the first move of a backward drag the anchor was therefore the left end, i.e. where the mouse just was. Every further move selected only between two neighbouring positions.
Fix
The bridge takes and reports anchor and focus. It sets the range with selectionDirection: 'backward' when focus < anchor, and reads the direction back in sync.
TextField passes selStart/selEnd through unchanged.
Shift+Arrow to the left goes through the same sync, so the drawn caret should now sit at the moving end there too. Not tested separately.
Test
e2e 2d-ii drags across the name field from right to left and reads the hidden input: 0..length, backward.
Selecting text in a field with the mouse works from left to right. From right to left the selection does not grow: the caret just follows the mouse to the left.
## Cause
`TextField` keeps the selection as anchor (`selStart`) and focus (`selEnd`) and pushes it into the hidden `<input>` of the `KeyboardBridge`. The bridge set the range ordered (`lo, hi`) and without a direction. The browser answers with a `selectionchange`, and the bridge reported `selectionStart`/`selectionEnd` back, again ordered. After the first move of a backward drag the anchor was therefore the left end, i.e. where the mouse just was. Every further move selected only between two neighbouring positions.
## Fix
- The bridge takes and reports anchor and focus. It sets the range with `selectionDirection: 'backward'` when focus < anchor, and reads the direction back in `sync`.
- `TextField` passes `selStart`/`selEnd` through unchanged.
Shift+Arrow to the left goes through the same `sync`, so the drawn caret should now sit at the moving end there too. Not tested separately.
## Test
e2e 2d-ii drags across the name field from right to left and reads the hidden input: `0..length`, `backward`.
Cause: Canvas text fields mirror their selection into a hidden <input> (src/ui/KeyboardBridge.ts). It always got the range sorted and without a direction, and its selectionchange echo handed back the sorted range. Dragging right to left therefore moved the anchor to the mouse on the first move, and every further move only selected between two neighbouring positions. It looked like the cursor just moving left.
Fix:
The bridge works with anchor and focus. It sets 'backward' as the direction when the focus lies before the anchor, and reads selectionDirection back.
TextField passes both through unchanged, its own sorting is gone.
Shift+Left runs through the same path. Not tested on its own.
Tests:
./check.sh: 167 files, 2435 tests, CHECK EXIT 0
e2e 2: ALL PASSED, 25 checks. New check 2d-ii drags right to left in the name field with real mouse moves and reads {"start":0,"end":13,"direction":"backward"}.
Counter-check without the direction: 2d-ii fails with "end":2, the reported symptom.
e2e check total is now 1401 (README and wiki Development), computed, not yet confirmed by CI.
Fixed in 1b3cb62.
**Cause:** Canvas text fields mirror their selection into a hidden `<input>` (`src/ui/KeyboardBridge.ts`). It always got the range sorted and without a direction, and its `selectionchange` echo handed back the sorted range. Dragging right to left therefore moved the anchor to the mouse on the first move, and every further move only selected between two neighbouring positions. It looked like the cursor just moving left.
**Fix:**
- The bridge works with anchor and focus. It sets `'backward'` as the direction when the focus lies before the anchor, and reads `selectionDirection` back.
- `TextField` passes both through unchanged, its own sorting is gone.
- Shift+Left runs through the same path. Not tested on its own.
**Tests:**
- `./check.sh`: 167 files, 2435 tests, CHECK EXIT 0
- e2e 2: ALL PASSED, 25 checks. New check 2d-ii drags right to left in the name field with real mouse moves and reads `{"start":0,"end":13,"direction":"backward"}`.
- Counter-check without the direction: 2d-ii fails with `"end":2`, the reported symptom.
- e2e check total is now 1401 (README and wiki *Development*), computed, not yet confirmed by CI.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Selecting text in a field with the mouse works from left to right. From right to left the selection does not grow: the caret just follows the mouse to the left.
Cause
TextFieldkeeps the selection as anchor (selStart) and focus (selEnd) and pushes it into the hidden<input>of theKeyboardBridge. The bridge set the range ordered (lo, hi) and without a direction. The browser answers with aselectionchange, and the bridge reportedselectionStart/selectionEndback, again ordered. After the first move of a backward drag the anchor was therefore the left end, i.e. where the mouse just was. Every further move selected only between two neighbouring positions.Fix
selectionDirection: 'backward'when focus < anchor, and reads the direction back insync.TextFieldpassesselStart/selEndthrough unchanged.Shift+Arrow to the left goes through the same
sync, so the drawn caret should now sit at the moving end there too. Not tested separately.Test
e2e 2d-ii drags across the name field from right to left and reads the hidden input:
0..length,backward.Fixed in
1b3cb62.Cause: Canvas text fields mirror their selection into a hidden
<input>(src/ui/KeyboardBridge.ts). It always got the range sorted and without a direction, and itsselectionchangeecho handed back the sorted range. Dragging right to left therefore moved the anchor to the mouse on the first move, and every further move only selected between two neighbouring positions. It looked like the cursor just moving left.Fix:
'backward'as the direction when the focus lies before the anchor, and readsselectionDirectionback.TextFieldpasses both through unchanged, its own sorting is gone.Tests:
./check.sh: 167 files, 2435 tests, CHECK EXIT 0{"start":0,"end":13,"direction":"backward"}."end":2, the reported symptom.