[bugs:#2488] SCI_SETSELECTIONNSTART and END set anchor and caret instead
Status: open
Group: Bug
Labels: scintilla
Created: Sat Sep 27, 2025 04:06 PM UTC by Tom Mewett
Last Updated: Sat Sep 27, 2025 04:06 PM UTC
Owner: nobody
SCI_SETSELECTIONNSTART sets the selection anchor, instead of the selection start. Similarly, SCI_SETSELECTIONNEND sets the selection caret, instead of the selection end.
This can be seen in Editor.cxx
:
case Message::SetSelectionNStart:
sel.Range(wParam).anchor.SetPosition(lParam);
break;
case Message::SetSelectionNEnd:
sel.Range(wParam).caret.SetPosition(lParam);
break;
Contrast this with SCI_GETSELECTIONNSTART and END, which correctly get the start and end:
case Message::GetSelectionNStart:
return sel.Range(wParam).Start().Position();
// ...
case Message::GetSelectionNEnd:
return sel.Range(wParam).End().Position();
Sent from sourceforge.net because scintill...@googlegroups.com is subscribed to https://sourceforge.net/p/scintilla/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/scintilla/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
This issue does not describe the desired solution.
Please specify the behaviour you want completely.
The main justification for these calls is symmetry - there are GetSelectionNStart
and GetSelectionNEnd
calls so adding the 'set' calls makes it simpler for applications to treat them as properties.
Hi Neil
The desired solution is that SCI_SETSELECTIONNSTART sets the selection start point, as the function name implies. Same for SCI_SETSELECTIONNEND. Currently they set the anchor and caret respectively, which is a problem as the anchor isn't always at the start and the caret isn't always at the end.
The main justification for these calls is symmetry
Exactly - the issue is that they currently aren't symmetric. In other words, the Set call does not modify the property that the Get call retrieves.
[bugs:#2488] SCI_SETSELECTIONNSTART and END set anchor and caret instead
Status: open
Group: Bug
Labels: scintilla
Created: Sat Sep 27, 2025 04:06 PM UTC by Tom Mewett
Last Updated: Sat Sep 27, 2025 10:31 PM UTC
Owner: nobody
The desired solution is that SCI_SETSELECTIONNSTART sets the selection start point
When I said "specify ... completely" I meant "completely", not just restating the title.
Specify the algorithm you want. In detail.
[bugs:#2488] SCI_SETSELECTIONNSTART and END set anchor and caret instead
Status: open
Group: Bug
Labels: scintilla
Created: Sat Sep 27, 2025 04:06 PM UTC by Tom Mewett
Last Updated: Sun Sep 28, 2025 11:30 AM UTC
Owner: nobody
If you don't know how to write out an algorithm, examine each possible situation and say what the result should be.
For example, if caretN=1,anchorN=2 what should be the resulting caret and anchor after SCI_SETSELECTIONNSTART(N,3)? If both caret and anchor are 2, what should the results of SCI_SETSELECTIONNSTART(N,3) be? Work through all the possible configurations and see if it produces a coherent design.
[bugs:#2488] SCI_SETSELECTIONNSTART and END set anchor and caret instead
Status: open
Group: Bug
Labels: scintilla
Created: Sat Sep 27, 2025 04:06 PM UTC by Tom Mewett
Last Updated: Sun Sep 28, 2025 10:24 PM UTC
Owner: nobody