25void SelectionPosition::MoveForInsertDelete(
bool insertion,
Sci::Position startChange,
Sci::Position length,
bool moveForEqual)
noexcept {
29 const Sci::Position virtualLengthRemove = std::min(length, virtualSpace);
30 virtualSpace -= virtualLengthRemove;
33 const Sci::Position lengthAfterVirtualRemove = length - virtualLengthRemove;
34 position += lengthAfterVirtualRemove;
57 return virtualSpace < other.virtualSpace;
64 return virtualSpace > other.virtualSpace;
70 if (
position == other.position && virtualSpace == other.virtualSpace)
77 if (
position == other.position && virtualSpace == other.virtualSpace)
98 const bool caretStart = caret.Position() < anchor.Position();
99 const bool anchorStart = anchor.Position() < caret.Position();
101 caret.MoveForInsertDelete(insertion, startChange, length, caretStart);
102 anchor.MoveForInsertDelete(insertion, startChange, length, anchorStart);
107 return (
pos >= caret.Position()) && (
pos <= anchor.Position());
109 return (
pos >= anchor.Position()) && (
pos <= caret.Position());
114 return (sp >= caret) && (sp <= anchor);
116 return (sp >= anchor) && (sp <= caret);
121 return (posCharacter >= caret.Position()) && (posCharacter < anchor.Position());
123 return (posCharacter >= anchor.Position()) && (posCharacter < caret.Position());
128 if ((inOrder.
start <= check.end) || (inOrder.
end >= check.start)) {
132 if (portion.
end > inOrder.
end)
133 portion.
end = inOrder.
end;
154 if ((startRange <= end) && (endRange >= start)) {
155 if ((start > startRange) && (end < endRange)) {
158 }
else if ((start < startRange) && (end > endRange)) {
161 }
else if (start <= startRange) {
169 if (anchor > caret) {
221 for (
size_t i=1; i<
ranges.size(); i++) {
279 moveExtends = moveExtends_;
293 if (lastPosition < range.caret)
294 lastPosition = range.caret;
295 if (lastPosition < range.anchor)
296 lastPosition = range.anchor;
304 len += range.Length();
311 range.MoveForInsertDelete(insertion, startChange, length);
313 if (selType == selRectangle) {
314 rangeRectangular.MoveForInsertDelete(insertion, startChange, length);
319 for (
size_t i=0; i<ranges.size();) {
320 if ((i != mainRange) && (ranges[i].Trim(range))) {
322 for (
size_t j=i; j<ranges.size()-1; j++) {
323 ranges[j] = ranges[j+1];
324 if (j == mainRange-1)
335 for (
size_t i = 0; i<ranges.size(); ++i) {
337 ranges[i].Trim(range);
364 mainNew =
ranges.size() - 2;
394 for (
size_t i=0; i<ranges.size(); i++) {
395 if (ranges[i].ContainsCharacter(posCharacter))
396 return i == mainRange ? 1 : 2;
402 for (
size_t i=0; i<ranges.size(); i++) {
404 return i == mainRange ? 1 : 2;
412 if ((range.caret.Position() ==
pos) && (virtualSpace < range.caret.VirtualSpace()))
413 virtualSpace = range.caret.VirtualSpace();
414 if ((range.anchor.Position() ==
pos) && (virtualSpace < range.anchor.VirtualSpace()))
415 virtualSpace = range.anchor.VirtualSpace();
431 for (
size_t i=0; i<
ranges.size()-1; i++) {
Defines global type name Position in the Sci internal namespace.
Interface to the edit control.
Classes maintaining the selection.
Sci::Position Position() const noexcept
Sci::Position VirtualSpace() const noexcept
void SetVirtualSpace(Sci::Position virtualSpace_) noexcept
SelectionPosition Start() const noexcept
int CharacterInSelection(Sci::Position posCharacter) const noexcept
Sci::Position MainAnchor() const noexcept
void SetMoveExtends(bool moveExtends_) noexcept
void DropAdditionalRanges()
void TrimSelection(SelectionRange range) noexcept
SelectionRange & Rectangular() noexcept
void MovePositions(bool insertion, Sci::Position startChange, Sci::Position length) noexcept
SelectionRange & RangeMain() noexcept
void CommitTentative() noexcept
void AddSelectionWithoutTrim(SelectionRange range)
void SetSelection(SelectionRange range)
SelectionPosition Last() const noexcept
void DropSelection(size_t r)
SelectionSegment Limits() const noexcept
std::vector< SelectionRange > rangesSaved
SelectionSegment LimitsForRectangularElseMain() const
int InSelectionForEOL(Sci::Position pos) const noexcept
bool IsRectangular() const noexcept
Sci::Position VirtualSpaceFor(Sci::Position pos) const noexcept
void RotateMain() noexcept
size_t Main() const noexcept
Sci::Position Length() const noexcept
std::vector< SelectionRange > ranges
bool MoveExtends() const noexcept
size_t Count() const noexcept
void AddSelection(SelectionRange range)
SelectionRange & Range(size_t r) noexcept
bool Empty() const noexcept
Sci::Position MainCaret() const noexcept
void TentativeSelection(SelectionRange range)
void TrimOtherSelections(size_t r, SelectionRange range) noexcept
SelectionRange rangeRectangular
void SetMain(size_t r) noexcept
Styling buffer using one element for each run rather than using a filled buffer.
void MinimizeVirtualSpace() noexcept
bool Contains(Sci::Position pos) const noexcept
SelectionSegment Intersect(SelectionSegment check) const noexcept
SelectionPosition Start() const noexcept
bool ContainsCharacter(Sci::Position posCharacter) const noexcept
void MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length) noexcept
bool Trim(SelectionRange range) noexcept
void Extend(SelectionPosition p) noexcept