Created attachment 145234 [details] minimal demo bash script SUMMARY Syntax-highlights confused by linebreak in bash condition [[ ]]. Subsequent lines get strange colors. This is just a minimal example. In my productive case, this continues over 150 lines to the end of the file. STEPS TO REPRODUCE 1. open attached bash script in kate and enjoy the syntax-highlight 2. add a space at end of line 3 in the middle of the condition 3. or view the animated gif OBSERVED RESULT Color of subsequent lines toggles. EXPECTED RESULT Subsequent lines shall always look as with the space in the condition. SOFTWARE/OS VERSIONS Betriebssystem: Kubuntu 21.10 KDE-Plasma-Version: 5.22.5 KDE-Frameworks-Version: 5.86.0 Qt-Version: 5.15.2 Kernel-Version: 5.13.0-22-generic (64-bit) Grafik-Plattform: X11 Prozessoren: 8 × Intel® Core™ i7-4700MQ CPU @ 2.40GHz Speicher: 15,5 GiB Arbeitsspeicher Grafikprozessor: Mesa DRI Intel® HD Graphics 4600 ADDITIONAL INFORMATION Adding a space at the end of the line is not really an option, because Kate and other editors have a feature to remove whitespace at end of line to clean up files - on save the workaround is automatically undone (on purpose)! I saw in bug 172473 comment 2 that the colors are heuristic, as you are not running your own compiler for every language.
Created attachment 145235 [details] animation of the color-change
Created attachment 145941 [details] test arguments with bracket syntax I can confirm this issue, and also would like to add another report minimal example.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/296
Git commit 45fe3516eb4c933138cd2eb913719acda4f7d41a by Christoph Cullmann, on behalf of Jonathan Poelen. Committed on 28/01/2022 at 20:56. Pushed by cullmann into branch 'master'. Bash: fix line-break in double bracket condition M +4 -0 autotests/folding/highlight.sh.fold M +4 -0 autotests/html/highlight.sh.dark.html M +4 -0 autotests/html/highlight.sh.html M +4 -0 autotests/input/highlight.sh M +4 -0 autotests/reference/highlight.sh.ref M +6 -3 data/syntax/bash.xml https://invent.kde.org/frameworks/syntax-highlighting/commit/45fe3516eb4c933138cd2eb913719acda4f7d41a