diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 8 | ||||
-rw-r--r-- | src/PositionCache.cxx | 7 | ||||
-rw-r--r-- | src/PositionCache.h | 3 | ||||
-rw-r--r-- | src/Selection.cxx | 8 | ||||
-rw-r--r-- | src/Selection.h | 2 |
5 files changed, 17 insertions, 11 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index e6a72e4cd..041a9c6a5 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2258,7 +2258,7 @@ void Editor::LayoutLine(int line, Surface *surface, const ViewStyle &vstyle, Lin ll->positions[0] = 0; bool lastSegItalics = false; - BreakFinder bfLayout(ll, 0, numCharsInLine, posLineStart, 0, false, pdoc, &reprs); + BreakFinder bfLayout(ll, NULL, 0, numCharsInLine, posLineStart, 0, false, pdoc, &reprs); while (bfLayout.More()) { const TextSegment ts = bfLayout.Next(); @@ -2898,10 +2898,8 @@ void Editor::DrawLine(Surface *surface, const ViewStyle &vsDraw, int line, int l // Does not take margin into account but not significant const int xStartVisible = static_cast<int>(subLineStart) - xStart; - ll->psel = &sel; - if (twoPhaseDraw) { - BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, xStartVisible, selBackDrawn, pdoc, &reprs); + BreakFinder bfBack(ll, &sel, lineStart, lineEnd, posLineStart, xStartVisible, selBackDrawn, pdoc, &reprs); // Background drawing loop while (bfBack.More()) { @@ -2994,7 +2992,7 @@ void Editor::DrawLine(Surface *surface, const ViewStyle &vsDraw, int line, int l inIndentation = subLine == 0; // Do not handle indentation except on first subline. // Foreground drawing loop - BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, xStartVisible, + BreakFinder bfFore(ll, &sel, lineStart, lineEnd, posLineStart, xStartVisible, ((!twoPhaseDraw && selBackDrawn) || vsDraw.selColours.fore.isSet), pdoc, &reprs); while (bfFore.More()) { diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index e35a1714c..f61999a4b 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -54,7 +54,6 @@ LineLayout::LineLayout(int maxLineLength_) : validity(llInvalid), xHighlightGuide(0), highlightColumn(0), - psel(NULL), containsCaret(false), edgeColumn(0), chars(0), @@ -440,7 +439,7 @@ void BreakFinder::Insert(int val) { } } -BreakFinder::BreakFinder(const LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, +BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, int lineStart_, int lineEnd_, int posLineStart_, int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_) : ll(ll_), lineStart(lineStart_), @@ -467,8 +466,8 @@ BreakFinder::BreakFinder(const LineLayout *ll_, int lineStart_, int lineEnd_, in SelectionPosition posStart(posLineStart); SelectionPosition posEnd(posLineStart + lineEnd); SelectionSegment segmentLine(posStart, posEnd); - for (size_t r=0; r<ll->psel->Count(); r++) { - SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine); + for (size_t r=0; r<psel->Count(); r++) { + SelectionSegment portion = psel->Range(r).Intersect(segmentLine); if (!(portion.start == portion.end)) { if (portion.start.IsValid()) Insert(portion.start.Position() - posLineStart); diff --git a/src/PositionCache.h b/src/PositionCache.h index e26b4b273..64ccfda34 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -34,7 +34,6 @@ public: enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity; int xHighlightGuide; bool highlightColumn; - Selection *psel; bool containsCaret; int edgeColumn; char *chars; @@ -170,7 +169,7 @@ public: enum { lengthStartSubdivision = 300 }; // Try to make each subdivided run lengthEachSubdivision or shorter. enum { lengthEachSubdivision = 100 }; - BreakFinder(const LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, + BreakFinder(const LineLayout *ll_, const Selection *psel, int lineStart_, int lineEnd_, int posLineStart_, int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_); ~BreakFinder(); TextSegment Next(); diff --git a/src/Selection.cxx b/src/Selection.cxx index 4c2ab0508..b46dca890 100644 --- a/src/Selection.cxx +++ b/src/Selection.cxx @@ -226,10 +226,18 @@ SelectionRange &Selection::Range(size_t r) { return ranges[r]; } +const SelectionRange &Selection::Range(size_t r) const { + return ranges[r]; +} + SelectionRange &Selection::RangeMain() { return ranges[mainRange]; } +const SelectionRange &Selection::RangeMain() const { + return ranges[mainRange]; +} + SelectionPosition Selection::Start() const { if (IsRectangular()) { return rangeRectangular.Start(); diff --git a/src/Selection.h b/src/Selection.h index e7f62f061..9e95fb043 100644 --- a/src/Selection.h +++ b/src/Selection.h @@ -156,7 +156,9 @@ public: size_t Main() const; void SetMain(size_t r); SelectionRange &Range(size_t r); + const SelectionRange &Range(size_t r) const; SelectionRange &RangeMain(); + const SelectionRange &RangeMain() const; SelectionPosition Start() const; bool MoveExtends() const; void SetMoveExtends(bool moveExtends_); |