Bug 578782 - Shift + Home / End changes selection direction for "reverse" selections
Summary: Shift + Home / End changes selection direction for "reverse" selections
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.22   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.23 RC1   Edit
Assignee: Mickael Istria CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2022-02-16 05:09 EST by Christoph Kaser CLA
Modified: 2022-02-18 11:20 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Kaser CLA 2022-02-16 05:09:37 EST
Build ID: I20220215-1800

When I have a selection across multiple lines in "reverse" direction (so the caret is at the start of the selection) and I press Shift+Home or Shift+End, the selection direction is "reversed" (the caret is at the end of the selection).

Steps to reproduce:

- Open a new untitled text file
- Enter the following text:

LINE 1
LINE 2
LINE 3
LINE 4
LINE 5

- Place the cursor before the "5"
- Press Shift + Up twice
- Observe that the caret now is before "3"
- Press Shift + End
- Observe that the caret now is before "5"

Expected behavior:
- The caret should be after "3"

I suspect this was introduced with the support for multiple selection ranges (Bug 466532) due to the changes to AbstractTextEditor.LineEndAction#run and AbstractTextEditor.LineStartAction#run.
Its underlying cause might be the fact that StyledText.getSelectionRanges() always returns the selection length >= 0, unlike StyledText.setSelectionRanges(), which uses length < 0 for "reverse" selections.
Comment 1 Andrey Loskutov CLA 2022-02-16 06:57:47 EST
Can still reproduce on head as of today.

@Mickael: any chance to have a fix for 4.23?
Comment 2 Mickael Istria CLA 2022-02-16 09:53:45 EST
(In reply to Andrey Loskutov from comment #1)
> @Mickael: any chance to have a fix for 4.23?

I can't tell yet, I'm on PTO tomorrow evening until end of next week and have some other work that I think is much more important to tackle at the moment. I'll try but it's very probable I won't have time for it. It also depends on what gets added to my backlog when I'm away, so I cannot really even plan.
Comment 3 Eclipse Genie CLA 2022-02-17 14:51:50 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.text/+/190925