-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yaml syntax highlighting does not respect empty lines in blocks of text #9038
Comments
Suggest something similar to diff --git a/scintilla/lexers/LexYAML.cxx b/scintilla/lexers/LexYAML.cxx
index 3002030d..e5a4cdfa 100644
--- a/scintilla/lexers/LexYAML.cxx
+++ b/scintilla/lexers/LexYAML.cxx
@@ -88,9 +88,11 @@ static void ColouriseYAMLLine(
if ((parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT || (parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT_PARENT) {
unsigned int parentIndentAmount = parentLineState&(~YAML_STATE_MASK);
- if (indentAmount > parentIndentAmount) {
+ if (lineBuffer[indentAmount] == '\0' || indentAmount > parentIndentAmount) {
styler.SetLineState(currentLine, YAML_STATE_TEXT | parentIndentAmount);
- styler.ColourTo(endPos, SCE_YAML_TEXT);
+ if (indentAmount > parentIndentAmount) {
+ styler.ColourTo(endPos, SCE_YAML_TEXT);
+ }
return;
}
} And I'd be happy to write a pull request with it if you believe its correct. |
You can directly write to Scintilla. |
What @ArkadiuszMichalski means is that this is a problem with Scintilla, not Notepad++. |
I can confirm this is NOT fixed in Notepad++ 7.9.3 Unicode Debug using the latest Scintilla 4.4.6 DLL. There are no YAML related updates to Scintilla change log since 3.7.5. Note that putting a single space on the blank line colors the text block correctly in both current 4.2.0 and 4.4.6. Cheers. |
See #15273. Issue still exists with N++ v8.6.7. |
There is a related issue posted at #15273 (comment), which I will repost here. - run: |
# first line of shell script
# last line of shell script
if: condition for running step [
{
"run": "# first line of shell script\n# last line of shell script\n",
"if": "condition for running step"
}
] Notepad++ fails to highlight it correctly. VS Code correctly highlights it. GitHub actually highlights this correctly, even though GitHub fails when there is a blank line in the string. |
Description of the Issue
Yaml syntax highlighting does not respect empty lines in blocks of text. An empty line is not considered to have lower indentation than the previous line, text blocks will continue across them.
Steps to Reproduce the Issue
Write yaml like this:
with row 2 empty
Expected Behavior
All lines above are highlighted as text
Actual Behavior
Rows 3 and 4 will be default-highlighted
Debug Information
Notepad++ v7.8.9 (64-bit)
Build time : Jul 15 2020 - 20:31:49
Admin mode : OFF
Local Conf mode : ON
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 1809
OS Build : 17763.1457
Current ANSI codepage : 1252
Plugins : GitSCM.dll MarkdownViewerPlusPlus.dll mimeTools.dll NppConverter.dll NppExport.dll NPPJSONViewer.dll NppXmlTreeviewPlugin.dll XMLTools.dll
The text was updated successfully, but these errors were encountered: