aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Selection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Selection.h')
-rw-r--r--src/Selection.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Selection.h b/src/Selection.h
index 57de92a57..8ffcbb0bb 100644
--- a/src/Selection.h
+++ b/src/Selection.h
@@ -81,6 +81,12 @@ struct SelectionSegment {
end = a;
}
}
+ constexpr SelectionSegment(Sci::Position a, Sci::Position b) :
+ SelectionSegment(SelectionPosition(a), SelectionPosition(b)) {
+ }
+ [[nodiscard]] constexpr bool operator ==(const SelectionSegment &other) const noexcept {
+ return (start == other.start) && (end == other.end);
+ }
bool Empty() const noexcept {
return start == end;
}
@@ -115,6 +121,9 @@ struct SelectionRange {
constexpr SelectionRange(Sci::Position caret_, Sci::Position anchor_) noexcept : caret(caret_), anchor(anchor_) {
}
explicit SelectionRange(std::string_view sv);
+ SelectionSegment AsSegment() const noexcept {
+ return {caret, anchor};
+ }
bool Empty() const noexcept {
return anchor == caret;
}