Bug 450478 - Bad bash highlighting with tilde and regexp
Summary: Bad bash highlighting with tilde and regexp
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: 5.91.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-17 18:33 UTC by Lothar
Modified: 2022-03-20 14:46 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lothar 2022-02-17 18:33:39 UTC
Try this this with bash highlighting

if [[ ! ("${argument}" =~ ^[1-9]+[0-9]*$) ]] ; then
    # This comment is not (all) grey. Removing this ' apostrophe helps next line 
    echo this line is all red, and next too
    # The ; after ]] in first line is red 
    # Removing ~ from =~ in first line helps with too much red
    # but the regexp is then all thin/black
    

KDE Frameworks Version: 5.91.0

Some years ago all was fine can't say when it starts
PS Sorry, can't find syntax component as bug addressee
Comment 1 Lothar 2022-02-18 10:28:19 UTC
Just a hint: Bash highlighting has a lot more issues. Using Zsh instead looks much better but not with this code snipped. Perhaps one should just start with the Zsh as blueprint to fix it
Comment 2 Gustavo Alvarez 2022-03-04 16:32:09 UTC
i, another example

~~~
esee=foo.bar
echo "${esee%%.*}"
echo "this text should be red instead white, remove the last \" after } turn red this text except the escaped charater"
~~~
Comment 3 Jonathan Poelen 2022-03-20 01:01:13 UTC
@Gustavo Alvarez: your other example is for another bug (#451363 which is fixed)
Comment 4 Bug Janitor Service 2022-03-20 02:03:41 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/303
Comment 5 Jonathan Poelen 2022-03-20 12:13:26 UTC
Git commit fcd703aefdcdaad88b9a82deee0878f5effd025b by Jonathan Poelen.
Committed on 20/03/2022 at 02:02.
Pushed by cullmann into branch 'master'.

Bash/Zsh: fix expression closing parenthesis in regex

M  +4    -0    autotests/folding/highlight.sh.fold
M  +6    -0    autotests/folding/test.zsh.fold
M  +4    -0    autotests/html/highlight.sh.dark.html
M  +4    -0    autotests/html/highlight.sh.html
M  +6    -0    autotests/html/test.zsh.dark.html
M  +6    -0    autotests/html/test.zsh.html
M  +4    -0    autotests/input/highlight.sh
M  +6    -0    autotests/input/test.zsh
M  +4    -0    autotests/reference/highlight.sh.ref
M  +6    -0    autotests/reference/test.zsh.ref
M  +2    -2    data/syntax/bash.xml
M  +4    -4    data/syntax/zsh.xml

https://invent.kde.org/frameworks/syntax-highlighting/commit/fcd703aefdcdaad88b9a82deee0878f5effd025b
Comment 6 Lothar 2022-03-20 14:46:06 UTC
Thank you Jonathan, this looks good now :-)