-
Notifications
You must be signed in to change notification settings - Fork 60
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
bash syntax highlighting broken with $ sign inside double quotes #180
Comments
It's due following code, which should be disabled for Lines 331 to 336 in f157108
it can be fixed by passing a parameter to |
A simple fix: diff --git a/lexers/LexBash.cxx b/lexers/LexBash.cxx
index 4945ef70..bc7cff71 100644
--- a/lexers/LexBash.cxx
+++ b/lexers/LexBash.cxx
@@ -864,7 +864,7 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int
if (stylingInside) {
sc.SetState(SCE_SH_BACKTICKS | insideCommand);
}
- } else if (sc.ch == '$') {
+ } else if (sc.ch == '$' && !AnyOf(sc.chNext, '\"', '\'')) {
QuoteStack.Expand(sc, cmdState, stylingInside);
continue;
} |
Example as text: egrep '^[A-Z]$'
test=foobar
egrep "^[A-Z]$"
test=foobar
egrep "^[A-Z]\$"
test=foobar Check in Linux for: echo '$'
echo "$"
echo "$"
echo "$"x"" Result: >bash 180example.sh
$
$
$
$x
>Exit code: 0 |
C-String test case: echo x$'\t'y
echo "x$'\t'y"
echo "x\ty" |
It seems to fully fix this we need a list of all special variables (the Bash special variables are list at https://www.gnu.org/software/bash/manual/bash.html#Variable-Index |
Created #184 as separate issue. |
There seems to be an issue with bash syntax highlighting when using a ‘$’ as the last character of a double quoted string. Up to notepad++-v8.5.3 everything was fine, but with v8.5.4 it breaks the syntax highlighting to the end of the document:
v8.5.3:
v8.5.4:
This can of course be fixed with escaping the ‘$’ sign:
Even though using an unescaped ‘$’ sign inside double quotes (when not referencing a variable) is not best practice, it should still not break the syntax highlighting.
The text was updated successfully, but these errors were encountered: