From c4771c41b036b67ffb6b72e67f9165a80ec24467 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 4 Nov 2019 07:55:57 +1100 Subject: Bug [#1933]. Fix highlighting of lines longer than 1024 characters. --- lexers/LexProps.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lexers') diff --git a/lexers/LexProps.cxx b/lexers/LexProps.cxx index 1aebdbb06..328033dd5 100644 --- a/lexers/LexProps.cxx +++ b/lexers/LexProps.cxx @@ -12,6 +12,8 @@ #include #include +#include + #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" @@ -79,10 +81,9 @@ static void ColourisePropsLine( } static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - char lineBuffer[1024]; + std::string lineBuffer; styler.StartAt(startPos); styler.StartSegment(startPos); - Sci_PositionU linePos = 0; Sci_PositionU startLine = startPos; // property lexer.props.allow.initial.spaces @@ -92,17 +93,16 @@ static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int, const bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0; for (Sci_PositionU i = startPos; i < startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { + lineBuffer.push_back(styler[i]); + if (AtEOL(styler, i)) { // End of line (or of line buffer) met, colourise it - lineBuffer[linePos] = '\0'; - ColourisePropsLine(lineBuffer, linePos, startLine, i, styler, allowInitialSpaces); - linePos = 0; + ColourisePropsLine(lineBuffer.c_str(), lineBuffer.length(), startLine, i, styler, allowInitialSpaces); + lineBuffer.clear(); startLine = i + 1; } } - if (linePos > 0) { // Last line does not have ending characters - ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler, allowInitialSpaces); + if (lineBuffer.length() > 0) { // Last line does not have ending characters + ColourisePropsLine(lineBuffer.c_str(), lineBuffer.length(), startLine, startPos + length - 1, styler, allowInitialSpaces); } } -- cgit v1.2.3