aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx12
1 files changed, 4 insertions, 8 deletions
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