aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Selection.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-12-08 14:38:07 +1100
committerNeil <nyamatongwe@gmail.com>2025-12-08 14:38:07 +1100
commit724429a7c661eeafe3094a049f747267d0496a69 (patch)
tree5e61c00fe32ca0860f0f24446a1421622c13e6a7 /src/Selection.cxx
parent3b9c68ac4239f07d7a9117010778987e5b98502c (diff)
downloadscintilla-mirror-724429a7c661eeafe3094a049f747267d0496a69.tar.gz
Bug [#2488]. Fix SCI_SETSELECTIONNSTART and SCI_SETSELECTIONNEND.
Diffstat (limited to 'src/Selection.cxx')
-rw-r--r--src/Selection.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Selection.cxx b/src/Selection.cxx
index 967033bff..e8d0148f5 100644
--- a/src/Selection.cxx
+++ b/src/Selection.cxx
@@ -182,6 +182,34 @@ SelectionSegment SelectionRange::Intersect(SelectionSegment check) const noexcep
};
}
+void SelectionRange::StartSet(SelectionPosition sp) noexcept {
+ if (anchor <= caret) {
+ anchor = sp;
+ if (caret < anchor) {
+ caret = anchor;
+ }
+ } else {
+ caret = sp;
+ if (anchor < caret) {
+ anchor = caret;
+ }
+ }
+}
+
+void SelectionRange::EndSet(SelectionPosition sp) noexcept {
+ if (caret >= anchor) {
+ caret = sp;
+ if (anchor > caret) {
+ anchor = caret;
+ }
+ } else {
+ anchor = sp;
+ if (caret > anchor) {
+ caret = anchor;
+ }
+ }
+}
+
void SelectionRange::Swap() noexcept {
std::swap(caret, anchor);
}