diff options
-rw-r--r-- | doc/ScintillaHistory.html | 5 | ||||
-rw-r--r-- | lexers/LexYAML.cxx | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 7caf33425..0cca9f7a0 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -543,6 +543,11 @@ The Python lexer recognizes identifiers more accurately when they include non-ASCII characters. </li> <li> + The YAML lexer recognizes comments in more situations and styles a + "..." line like a "---" line. + <a href="http://sourceforge.net/p/scintilla/bugs/1931/">Bug #1931</a>. + </li> + <li> On Cocoa, the autocompletion is 4 pixels wider to avoid text truncation. </li> <li> diff --git a/lexers/LexYAML.cxx b/lexers/LexYAML.cxx index 9f28bb843..3709538b7 100644 --- a/lexers/LexYAML.cxx +++ b/lexers/LexYAML.cxx @@ -98,7 +98,7 @@ static void ColouriseYAMLLine( } } styler.SetLineState(currentLine, 0); - if (strncmp(lineBuffer, "---", 3) == 0) { // Document marker + if (strncmp(lineBuffer, "---", 3) == 0 || strncmp(lineBuffer, "...", 3) == 0) { // Document marker styler.SetLineState(currentLine, YAML_STATE_DOCUMENT); styler.ColourTo(endPos, SCE_YAML_DOCUMENT); return; @@ -119,6 +119,10 @@ static void ColouriseYAMLLine( while (i < lengthLine) { if (lineBuffer[i] == '\'' || lineBuffer[i] == '\"') { bInQuotes = !bInQuotes; + } else if (lineBuffer[i] == '#' && isspacechar(lineBuffer[i - 1]) && !bInQuotes) { + styler.ColourTo(startLine + i - 1, SCE_YAML_DEFAULT); + styler.ColourTo(endPos, SCE_YAML_COMMENT); + return; } else if (lineBuffer[i] == ':' && !bInQuotes) { styler.ColourTo(startLine + i - 1, SCE_YAML_IDENTIFIER); styler.ColourTo(startLine + i, SCE_YAML_OPERATOR); |