aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Selection.h
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-05-01 16:48:50 +1000
committerNeil <nyamatongwe@gmail.com>2021-05-01 16:48:50 +1000
commit93591238af8bf8b5246adcfe7a115f443442f44e (patch)
tree94b402e2a6c39d622a49be999517ff83be9ce378 /src/Selection.h
parent1f5a3b0b2d81351819ebb189a1ae4379e8762e75 (diff)
downloadscintilla-mirror-93591238af8bf8b5246adcfe7a115f443442f44e.tar.gz
Improve selection drawing code. Use InSelection enum instead of int.
Add Selection::RangeType and EditModel::LineEndInSelection to hoist code out of EditView. Replace SimpleAlphaRectangle with Surface::FillRectangleAligned when alpha known to not be SC_ALPHA_NOALPHA.
Diffstat (limited to 'src/Selection.h')
-rw-r--r--src/Selection.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Selection.h b/src/Selection.h
index 1ad4fa7c0..c8daa3932 100644
--- a/src/Selection.h
+++ b/src/Selection.h
@@ -133,6 +133,9 @@ struct SelectionRange {
void MinimizeVirtualSpace() noexcept;
};
+// Deliberately an enum rather than an enum class to allow treating as bool
+enum InSelection { inNone, inMain, inAdditional };
+
class Selection {
std::vector<SelectionRange> ranges;
std::vector<SelectionRange> rangesSaved;
@@ -178,8 +181,9 @@ public:
void DropAdditionalRanges();
void TentativeSelection(SelectionRange range);
void CommitTentative() noexcept;
- int CharacterInSelection(Sci::Position posCharacter) const noexcept;
- int InSelectionForEOL(Sci::Position pos) const noexcept;
+ InSelection RangeType(size_t r) const noexcept;
+ InSelection CharacterInSelection(Sci::Position posCharacter) const noexcept;
+ InSelection InSelectionForEOL(Sci::Position pos) const noexcept;
Sci::Position VirtualSpaceFor(Sci::Position pos) const noexcept;
void Clear();
void RemoveDuplicates();