Bug 459972

Summary: non breaking space prevent keywords highlighting in comments
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: Xavier Brochard <xavier>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: walter.von.entferndt
Priority: NOR    
Version First Reported In: 5.98.0   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Xavier Brochard 2022-10-04 14:07:13 UTC
Syntax highlighting doesn't work if a non-breaking space follow a keyword in comments. However, it works well if  a non-breaking space is before a keyword. Same behaviour in code. May be this is intentional for code, but in comments with keywords like TODO, FIXME and so on, I find this behaviour annoying.

Tested with Perl, Bash, Python and C.

To see sample cases in Perl, try this:

#! /usr/bin/perl
#
# highlighted:
#TODO
#[normal space]TODO
#[normal space]TODO[normal space]
#[non breaking space here]TODO
#[non breaking space here]TODO[normal space]
#
# not highlighted:
#TODO[non breaking space here]
#[normal space]TODO[non breaking space here]
Comment 1 Bug Janitor Service 2022-10-17 00:48:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/372
Comment 2 Christoph Cullmann 2022-10-17 18:33:07 UTC
Git commit 8fe3d8facf503f3bade421da6522c4b671980ba2 by Christoph Cullmann, on behalf of Jonathan Poelen.
Committed on 17/10/2022 at 17:11.
Pushed by cullmann into branch 'master'.

Alerts: add NO-BREAK SPACE (nbsp) as keyword deliminator

M  +3    -0    autotests/folding/test-alerts.fold
M  +3    -0    autotests/html/test-alerts.dark.html
M  +3    -0    autotests/html/test-alerts.html
M  +3    -0    autotests/input/test-alerts
M  +3    -0    autotests/reference/test-alerts.ref
M  +3    -2    data/syntax/alert.xml

https://invent.kde.org/frameworks/syntax-highlighting/commit/8fe3d8facf503f3bade421da6522c4b671980ba2
Comment 3 Xavier Brochard 2022-10-18 07:27:06 UTC
thanks !