From 476950a6ae073471d2cd112c40d60f76d1e4db81 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 25 Apr 2013 09:38:06 +1000 Subject: Fix bug with setting atLineEnd at end of document. --- lexlib/StyleContext.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lexlib/StyleContext.h') diff --git a/lexlib/StyleContext.h b/lexlib/StyleContext.h index 2d3cfc1fc..c79d42e37 100644 --- a/lexlib/StyleContext.h +++ b/lexlib/StyleContext.h @@ -76,7 +76,7 @@ class StyleContext { // End of line? // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) // or on LF alone (Unix). Avoid triggering two times on Dos/Win. - if (lineStartNext < styler.Length()) + if (currentLine < lineDocEnd) atLineEnd = static_cast(pos) >= (lineStartNext-1); else // Last line atLineEnd = static_cast(pos) >= lineStartNext; @@ -85,6 +85,7 @@ class StyleContext { public: unsigned int currentPos; int currentLine; + int lineDocEnd; int lineStartNext; bool atLineStart; bool atLineEnd; @@ -112,6 +113,7 @@ public: lengthDocument = static_cast(styler.Length()); if (endPos == lengthDocument) endPos++; + lineDocEnd = styler.GetLine(lengthDocument); atLineStart = static_cast(styler.LineStart(currentLine)) == startPos; unsigned int pos = currentPos; ch = static_cast(styler.SafeGetCharAt(pos, 0)); -- cgit v1.2.3