diff options
author | Neil <nyamatongwe@gmail.com> | 2025-02-05 20:19:18 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2025-02-05 20:19:18 +1100 |
commit | f8d3a96296b898cbca5faf1e326b3a3b0d162672 (patch) | |
tree | cb0d392233fa299687701b5a47a55855db909285 /src/PositionCache.cxx | |
parent | ac415de8e8457471528908f73996be78613c4620 (diff) | |
download | scintilla-mirror-f8d3a96296b898cbca5faf1e326b3a3b0d162672.tar.gz |
Use new SelectionSegment constructor and SelectionRange::AsSegment to simplify
code.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 12 |
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 |