Bug 398717

Summary: Syntax highlighting of email is broken by unclosed parenthesis in header line
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: Erik Quaeghebeur <bugs.kde.org>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 5.46.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 5.51
Attachments: Test case

Description Erik Quaeghebeur 2018-09-16 13:14:58 UTC
Created attachment 115012 [details]
Test case

If there is an unbroken parenthesis in the header line of an email, then everything that follows is commented (gray). While it is true that parentheses enclose comments in most header fields, this does not hold for all fields, e.g., not for Subject. So some extra care needs to be taken to avoid erroneous interpretation as a comment there (and perhaps other fields).

Maybe special-casing Subject and breaking of comment-color at the end of the header is the solution.
Comment 1 Dominik Haumann 2018-09-16 18:10:13 UTC
Git commit b1da54ab91e331fdecbe07a9f40a9c1908143a4b by Dominik Haumann.
Committed on 16/09/2018 at 18:10.
Pushed by dhaumann into branch 'master'.

Fix: Email highlighting for unclosed parenthesis in Subject header

Summary:
Unfortunately, the "Subject:" header needs to be treated independently
of the other headers, since it may contain arbitrary text such as paranthesis
that is not a comment or similar. The fix is to add another context without
the comment highlighting.

Test Plan: make test

Reviewers: vkrause

Reviewed By: vkrause

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D15556

M  +2    -2    autotests/folding/test.eml.fold
M  +2    -2    autotests/html/test.eml.html
M  +2    -2    autotests/input/test.eml
M  +2    -2    autotests/reference/test.eml.ref
M  +7    -1    data/syntax/email.xml

https://commits.kde.org/syntax-highlighting/b1da54ab91e331fdecbe07a9f40a9c1908143a4b