diff options
author | nyamatongwe <devnull@localhost> | 2012-02-08 22:21:44 +1100 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2012-02-08 22:21:44 +1100 |
commit | dbd103c4bd65e0dca040edb3aacd3bc30fe0ac78 (patch) | |
tree | 9cd22091687cdbeb3ead95d061ea3b3fffc29f38 /src | |
parent | f8d4f6ac27b894c75b894ae066257de360ae2ea3 (diff) | |
download | scintilla-mirror-dbd103c4bd65e0dca040edb3aacd3bc30fe0ac78.tar.gz |
Fix spurious extra indentation guide at end of indentation caused by change
to fractional positioning.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 5ed364090..a6b699298 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2820,7 +2820,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis (!overrideBackground) && (vsDraw.whitespaceBackgroundSet); bool inIndentation = subLine == 0; // Do not handle indentation except on first subline. - int indentWidth = pdoc->IndentSize() * vsDraw.spaceWidth; + const XYPOSITION indentWidth = pdoc->IndentSize() * vsDraw.spaceWidth; + const XYPOSITION epsilon = 0.0001f; // A small nudge to avoid floating point precision issues int posLineStart = pdoc->LineStart(line); @@ -3037,10 +3038,13 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis surface->PenColour(textFore); } if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { - for (int xIG = ll->positions[i] / indentWidth * indentWidth; xIG < ll->positions[i + 1]; xIG += indentWidth) { - if (xIG >= ll->positions[i] && xIG > 0) { - DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIG + xStart, rcSegment, - (ll->xHighlightGuide == xIG)); + for (int indentCount = (ll->positions[i] + epsilon) / indentWidth; + indentCount <= (ll->positions[i + 1] - epsilon) / indentWidth; + indentCount++) { + if (indentCount > 0) { + int xIndent = indentCount * indentWidth; + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, + (ll->xHighlightGuide == xIndent)); } } } @@ -3107,10 +3111,14 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis } } if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { - int startSpace = ll->positions[cpos + startseg]; - if (startSpace > 0 && (startSpace % indentWidth == 0)) { - DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, startSpace + xStart, rcSegment, - (ll->xHighlightGuide == ll->positions[cpos + startseg])); + for (int indentCount = (ll->positions[cpos + startseg] + epsilon) / indentWidth; + indentCount <= (ll->positions[cpos + startseg + 1] - epsilon) / indentWidth; + indentCount++) { + if (indentCount > 0) { + int xIndent = indentCount * indentWidth; + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, + (ll->xHighlightGuide == xIndent)); + } } } } else { |