aboutsummaryrefslogtreecommitdiffhomepage
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
parent78ac9f3ecf3ee474ea2e6c45ae32450a5b6d2ac4 (diff)
downloadscintilla-mirror-c4771c41b036b67ffb6b72e67f9165a80ec24467.tar.gz
Bug [#1933]. Fix highlighting of lines longer than 1024 characters.
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--lexers/LexProps.cxx18
2 files changed, 13 insertions, 9 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index d7312f008..7ac3f1758 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -579,6 +579,10 @@
<a href="https://sourceforge.net/p/scintilla/feature-requests/1320/">Feature #1320</a>.
</li>
<li>
+ Fix bug in properties file lexer where long lines were only styled for the first 1024 characters.
+ <a href="https://sourceforge.net/p/scintilla/bugs/1933/">Bug #1933</a>.
+ </li>
+ <li>
Avoid unnecessary IME caret movement on Win32.
<a href="https://sourceforge.net/p/scintilla/feature-requests/1304/">Feature #1304</a>.
</li>
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);
}
}