diff options
author | Neil <nyamatongwe@gmail.com> | 2018-05-13 15:12:59 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-05-13 15:12:59 +1000 |
commit | 0e3b1076abe9efe41952d12ab5dfb9de10fa1f88 (patch) | |
tree | f29daea86e2931311a1e6b10c1b3109117e67240 | |
parent | 69b556ea13124d67750c82c2a02d902ddaa78151 (diff) | |
download | scintilla-mirror-0e3b1076abe9efe41952d12ab5dfb9de10fa1f88.tar.gz |
When line end characters are displayed, indicators are drawn under/over them.
-rw-r--r-- | doc/ScintillaHistory.html | 3 | ||||
-rw-r--r-- | src/EditView.cxx | 13 | ||||
-rw-r--r-- | src/PositionCache.cxx | 10 | ||||
-rw-r--r-- | src/PositionCache.h | 5 |
4 files changed, 18 insertions, 13 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 95f2c8fd2..d2a223985 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -542,6 +542,9 @@ <li> Released 10 May 2018. </li> + <li> + Indicators are drawn for line end characters when displayed. + </li> </ul> <h3> <a href="https://www.scintilla.org/scite405.zip">Release 4.0.5</a> diff --git a/src/EditView.cxx b/src/EditView.cxx index dc8ba1c2d..713aa482a 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -628,7 +628,7 @@ Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, Sci:: const Sci::Line lineStartSet = model.pcs->DisplayFromDoc(lineDoc); const int subLine = static_cast<int>(lineVisible - lineStartSet); if (subLine < ll->lines) { - rangeSubLine = ll->SubLineRange(subLine); + rangeSubLine = ll->SubLineRange(subLine, LineLayout::Scope::visibleOnly); if (subLine == ll->lines-1) { rangeSubLine.end = model.pdoc->LineStart(lineDoc + 1) - positionLineStart; @@ -658,7 +658,7 @@ SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditMo const Sci::Line lineStartSet = model.pcs->DisplayFromDoc(lineDoc); const int subLine = static_cast<int>(visibleLine - lineStartSet); if (subLine < ll->lines) { - const Range rangeSubLine = ll->SubLineRange(subLine); + const Range rangeSubLine = ll->SubLineRange(subLine, LineLayout::Scope::visibleOnly); const XYPOSITION subLineStart = ll->positions[rangeSubLine.start]; if (subLine > 0) // Wrapped pt.x -= ll->wrapIndent; @@ -696,7 +696,7 @@ SelectionPosition EditView::SPositionFromLineX(Surface *surface, const EditModel if (surface && ll) { const Sci::Position posLineStart = model.pdoc->LineStart(lineDoc); LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); - const Range rangeSubLine = ll->SubLineRange(0); + const Range rangeSubLine = ll->SubLineRange(0, LineLayout::Scope::visibleOnly); const XYPOSITION subLineStart = ll->positions[rangeSubLine.start]; const Sci::Position positionInLine = ll->FindPositionFromX(x + subLineStart, rangeSubLine, false); if (positionInLine < rangeSubLine.end) { @@ -1883,7 +1883,8 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl const Sci::Position posLineStart = model.pdoc->LineStart(line); - const Range lineRange = ll->SubLineRange(subLine); + const Range lineRange = ll->SubLineRange(subLine, LineLayout::Scope::visibleOnly); + const Range lineRangeIncludingEnd = ll->SubLineRange(subLine, LineLayout::Scope::includeEnd); const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; if ((ll->wrapIndent != 0) && (subLine > 0)) { @@ -1906,7 +1907,7 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl } if (phase & drawIndicatorsBack) { - DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, true, model.hoverIndicatorPos); + DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRangeIncludingEnd.end, true, model.hoverIndicatorPos); DrawEdgeLine(surface, vsDraw, ll, rcLine, lineRange, xStart); DrawMarkUnderline(surface, model, vsDraw, line, rcLine); } @@ -1922,7 +1923,7 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl } if (phase & drawIndicatorsFore) { - DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, false, model.hoverIndicatorPos); + DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRangeIncludingEnd.end, false, model.hoverIndicatorPos); } DrawFoldDisplayText(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, subLineStart, phase); diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 8ed0580bb..680afbacd 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -104,18 +104,18 @@ int LineLayout::LineStart(int line) const { } } -int LineLayout::LineLastVisible(int line) const { +int LineLayout::LineLastVisible(int line, Scope scope) const { if (line < 0) { return 0; } else if ((line >= lines-1) || !lineStarts) { - return numCharsBeforeEOL; + return scope == Scope::visibleOnly ? numCharsBeforeEOL : numCharsInLine; } else { return lineStarts[line+1]; } } -Range LineLayout::SubLineRange(int subLine) const { - return Range(LineStart(subLine), LineLastVisible(subLine)); +Range LineLayout::SubLineRange(int subLine, Scope scope) const { + return Range(LineStart(subLine), LineLastVisible(subLine, scope)); } bool LineLayout::InLine(int offset, int line) const { @@ -218,7 +218,7 @@ Point LineLayout::PointFromPosition(int posInLine, int lineHeight, PointEnd pe) } for (int subLine = 0; subLine < lines; subLine++) { - const Range rangeSubLine = SubLineRange(subLine); + const Range rangeSubLine = SubLineRange(subLine, Scope::visibleOnly); if (posInLine >= rangeSubLine.start) { pt.y = static_cast<XYPOSITION>(subLine*lineHeight); if (posInLine <= rangeSubLine.end) { diff --git a/src/PositionCache.h b/src/PositionCache.h index 2b3ea1485..7f50c4dec 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -85,8 +85,9 @@ public: void Free(); void Invalidate(validLevel validity_); int LineStart(int line) const; - int LineLastVisible(int line) const; - Range SubLineRange(int subLine) const; + enum class Scope { visibleOnly, includeEnd }; + int LineLastVisible(int line, Scope scope) const; + Range SubLineRange(int subLine, Scope scope) const; bool InLine(int offset, int line) const; void SetLineStart(int line, int start); void SetBracesHighlight(Range rangeLine, const Sci::Position braces[], |