diff options
Diffstat (limited to 'lexers')
-rw-r--r-- | lexers/LexErrorList.cxx | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lexers/LexErrorList.cxx b/lexers/LexErrorList.cxx index 34bf968fb..0fc389646 100644 --- a/lexers/LexErrorList.cxx +++ b/lexers/LexErrorList.cxx @@ -12,6 +12,8 @@ #include <assert.h> #include <ctype.h> +#include <string> + #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" @@ -319,17 +321,17 @@ int StyleFromSequence(const char *seq) noexcept { } void ColouriseErrorListLine( - char *lineBuffer, - Sci_PositionU lengthLine, + const std::string &lineBuffer, Sci_PositionU endPos, Accessor &styler, bool valueSeparate, bool escapeSequences) { Sci_Position startValue = -1; - const int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue); - if (escapeSequences && strstr(lineBuffer, CSI)) { + const Sci_PositionU lengthLine = lineBuffer.length(); + const int style = RecogniseErrorListLine(lineBuffer.c_str(), lengthLine, startValue); + if (escapeSequences && strstr(lineBuffer.c_str(), CSI)) { const Sci_Position startPos = endPos - lengthLine; - const char *linePortion = lineBuffer; + const char *linePortion = lineBuffer.c_str(); Sci_Position startPortion = startPos; int portionStyle = style; while (const char *startSeq = strstr(linePortion, CSI)) { @@ -370,10 +372,9 @@ void ColouriseErrorListLine( } void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - char lineBuffer[10000]; + std::string lineBuffer; styler.StartAt(startPos); styler.StartSegment(startPos); - Sci_PositionU linePos = 0; // property lexer.errorlist.value.separate // For lines in the output pane that are matches from Find in Files or GCC-style @@ -387,17 +388,15 @@ void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, int, Wor const bool escapeSequences = styler.GetPropertyInt("lexer.errorlist.escape.sequences") != 0; for (Sci_PositionU i = startPos; i < startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { - // End of line (or of line buffer) met, colourise it - lineBuffer[linePos] = '\0'; - ColouriseErrorListLine(lineBuffer, linePos, i, styler, valueSeparate, escapeSequences); - linePos = 0; + lineBuffer.push_back(styler[i]); + if (AtEOL(styler, i)) { + // End of line met, colourise it + ColouriseErrorListLine(lineBuffer, i, styler, valueSeparate, escapeSequences); + lineBuffer.clear(); } } - if (linePos > 0) { // Last line does not have ending characters - lineBuffer[linePos] = '\0'; - ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler, valueSeparate, escapeSequences); + if (!lineBuffer.empty()) { // Last line does not have ending characters + ColouriseErrorListLine(lineBuffer, startPos + length - 1, styler, valueSeparate, escapeSequences); } } |