aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexProps.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-11-04 07:55:57 +1100
committerNeil <nyamatongwe@gmail.com>2019-11-04 07:55:57 +1100
commitc4771c41b036b67ffb6b72e67f9165a80ec24467 (patch)
tree415721d0fd77646510aaa7fa3b0d8d61d084fc61 /lexers/LexProps.cxx
parent78ac9f3ecf3ee474ea2e6c45ae32450a5b6d2ac4 (diff)
downloadscintilla-mirror-c4771c41b036b67ffb6b72e67f9165a80ec24467.tar.gz
Bug [#1933]. Fix highlighting of lines longer than 1024 characters.
Diffstat (limited to 'lexers/LexProps.cxx')
-rw-r--r--lexers/LexProps.cxx18
1 files changed, 9 insertions, 9 deletions
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 <assert.h>
#include <ctype.h>
+#include <string>
+
#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);
}
}