diff options
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 { | 
