From 724429a7c661eeafe3094a049f747267d0496a69 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 8 Dec 2025 14:38:07 +1100 Subject: Bug [#2488]. Fix SCI_SETSELECTIONNSTART and SCI_SETSELECTIONNEND. --- src/Selection.cxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/Selection.cxx') 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); } -- cgit v1.2.3