MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / SelectionRange

Class SelectionRange

scintilla/src/Selection.h:85–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83};
84
85struct SelectionRange {
86 SelectionPosition caret;
87 SelectionPosition anchor;
88
89 SelectionRange() : caret(), anchor() {
90 }
91 SelectionRange(SelectionPosition single) : caret(single), anchor(single) {
92 }
93 SelectionRange(int single) : caret(single), anchor(single) {
94 }
95 SelectionRange(SelectionPosition caret_, SelectionPosition anchor_) : caret(caret_), anchor(anchor_) {
96 }
97 SelectionRange(int caret_, int anchor_) : caret(caret_), anchor(anchor_) {
98 }
99 bool Empty() const {
100 return anchor == caret;
101 }
102 int Length() const;
103 // int Width() const; // Like Length but takes virtual space into account
104 bool operator ==(const SelectionRange &other) const {
105 return caret == other.caret && anchor == other.anchor;
106 }
107 bool operator <(const SelectionRange &other) const {
108 return caret < other.caret || ((caret == other.caret) && (anchor < other.anchor));
109 }
110 void Reset() {
111 anchor.Reset();
112 caret.Reset();
113 }
114 void ClearVirtualSpace() {
115 anchor.SetVirtualSpace(0);
116 caret.SetVirtualSpace(0);
117 }
118 bool Contains(int pos) const;
119 bool Contains(SelectionPosition sp) const;
120 bool ContainsCharacter(int posCharacter) const;
121 SelectionSegment Intersect(SelectionSegment check) const;
122 SelectionPosition Start() const {
123 return (anchor < caret) ? anchor : caret;
124 }
125 SelectionPosition End() const {
126 return (anchor < caret) ? caret : anchor;
127 }
128 bool Trim(SelectionRange range);
129 // If range is all virtual collapse to start of virtual space
130 void MinimizeVirtualSpace();
131};
132
133class Selection {
134 std::vector<SelectionRange> ranges;

Callers 15

ThinRectangularRangeMethod · 0.85
SetSelectionMethod · 0.85
MovePositionToMethod · 0.85
MoveSelectedLinesMethod · 0.85
EnsureCaretVisibleMethod · 0.85
PasteRectangularMethod · 0.85
DelCharBackMethod · 0.85
DuplicateMethod · 0.85
IndentMethod · 0.85
DropAtMethod · 0.85
TrimAndSetSelectionMethod · 0.85
ButtonDownMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected