diff options
-rw-r--r-- | src/Editor.cxx | 4 | ||||
-rw-r--r-- | src/PositionCache.cxx | 12 | ||||
-rw-r--r-- | src/Selection.cxx | 4 |
3 files changed, 8 insertions, 12 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index a29aa08fc..77d2eb175 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -8503,8 +8503,8 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { case Message::GetLineSelStartPosition: case Message::GetLineSelEndPosition: { const SelectionSegment segmentLine( - SelectionPosition(pdoc->LineStart(LineFromUPtr(wParam))), - SelectionPosition(pdoc->LineEnd(LineFromUPtr(wParam)))); + pdoc->LineStart(LineFromUPtr(wParam)), + pdoc->LineEnd(LineFromUPtr(wParam))); for (size_t r=0; r<sel.Count(); r++) { const SelectionSegment portion = sel.Range(r).Intersect(segmentLine); if (portion.start.IsValid()) { diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 9cb617174..5cc8f8fe8 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -856,16 +856,12 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lin } if (FlagSet(breakFor, BreakFor::Selection)) { - const SelectionPosition posStart(posLineStart); - const SelectionPosition posEnd(posLineStart + lineRange.end); - const SelectionSegment segmentLine(posStart, posEnd); + const SelectionSegment segmentLine(posLineStart, posLineStart + lineRange.end); for (size_t r=0; r<psel->Count(); r++) { const SelectionSegment portion = psel->Range(r).Intersect(segmentLine); - if (!(portion.start == portion.end)) { - if (portion.start.IsValid()) - Insert(portion.start.Position() - posLineStart); - if (portion.end.IsValid()) - Insert(portion.end.Position() - posLineStart); + if (!portion.Empty()) { + Insert(portion.start.Position() - posLineStart); + Insert(portion.end.Position() - posLineStart); } } // On the curses platform, the terminal is drawing its own caret, so add breaks around the diff --git a/src/Selection.cxx b/src/Selection.cxx index 20fb1efca..527a9d29a 100644 --- a/src/Selection.cxx +++ b/src/Selection.cxx @@ -327,7 +327,7 @@ SelectionRange Selection::RectangularCopy() const noexcept { SelectionSegment Selection::Limits() const noexcept { PLATFORM_ASSERT(!ranges.empty()); - SelectionSegment sr(ranges[0].anchor, ranges[0].caret); + SelectionSegment sr = ranges[0].AsSegment(); for (size_t i=1; i<ranges.size(); i++) { sr.Extend(ranges[i].anchor); sr.Extend(ranges[i].caret); @@ -339,7 +339,7 @@ SelectionSegment Selection::LimitsForRectangularElseMain() const noexcept { if (IsRectangular()) { return Limits(); } else { - return SelectionSegment(ranges[mainRange].caret, ranges[mainRange].anchor); + return ranges[mainRange].AsSegment(); } } |