Bug 448126 - Syntax-Highlight chokes on line-break in bash condition
Summary: Syntax-Highlight chokes on line-break in bash condition
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: 5.90.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-08 17:31 UTC by Holger
Modified: 2022-02-01 20:26 UTC (History)
4 users (show)

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


Attachments
minimal demo bash script (87 bytes, application/x-shellscript)
2022-01-08 17:31 UTC, Holger
Details
animation of the color-change (48.85 KB, image/gif)
2022-01-08 17:32 UTC, Holger
Details
test arguments with bracket syntax (116 bytes, application/x-shellscript)
2022-01-25 22:15 UTC, Dominik Kummer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Holger 2022-01-08 17:31:31 UTC
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.
Comment 1 Holger 2022-01-08 17:32:36 UTC
Created attachment 145235 [details]
animation of the color-change
Comment 2 Dominik Kummer 2022-01-25 22:15:14 UTC
Created attachment 145941 [details]
test arguments with bracket syntax

I can confirm this issue, and also would like to add another report minimal example.
Comment 3 Bug Janitor Service 2022-01-25 23:54:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/296
Comment 4 Christoph Cullmann 2022-01-28 20:59:57 UTC
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