aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx2
-rw-r--r--src/Selection.cxx4
-rw-r--r--src/Selection.h1
3 files changed, 6 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 2a0ac420b..8a3a367db 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -7918,7 +7918,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_SWAPMAINANCHORCARET:
InvalidateSelection(sel.RangeMain());
- sel.RangeMain() = SelectionRange(sel.RangeMain().anchor, sel.RangeMain().caret);
+ sel.RangeMain().Swap();
break;
case SCI_MULTIPLESELECTADDNEXT:
diff --git a/src/Selection.cxx b/src/Selection.cxx
index a629c7e40..d58a03980 100644
--- a/src/Selection.cxx
+++ b/src/Selection.cxx
@@ -126,6 +126,10 @@ SelectionSegment SelectionRange::Intersect(SelectionSegment check) const {
}
}
+void SelectionRange::Swap() {
+ std::swap(caret, anchor);
+}
+
bool SelectionRange::Trim(SelectionRange range) {
SelectionPosition startRange = range.Start();
SelectionPosition endRange = range.End();
diff --git a/src/Selection.h b/src/Selection.h
index 22c01beff..5ec5c5424 100644
--- a/src/Selection.h
+++ b/src/Selection.h
@@ -126,6 +126,7 @@ struct SelectionRange {
SelectionPosition End() const {
return (anchor < caret) ? caret : anchor;
}
+ void Swap();
bool Trim(SelectionRange range);
// If range is all virtual collapse to start of virtual space
void MinimizeVirtualSpace();