Bug 452964 - Kate syntax coloring .xml <item> containing space
Summary: Kate syntax coloring .xml <item> containing space
Status: RESOLVED INTENTIONAL
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-25 00:37 UTC by Robert Wishlaw
Modified: 2022-10-02 17:03 UTC (History)
3 users (show)

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


Attachments
Syntax color example (6.77 KB, image/png)
2022-04-25 00:37 UTC, Robert Wishlaw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Wishlaw 2022-04-25 00:37:32 UTC
Created attachment 148347 [details]
Syntax color example

In a user defined Kate .xml syntax file, an item containing  a space does not process correctly, for example

<item>for binary append</item> 

 When the weakDeliminator attribute is used in the .xml file to instruct the parser to ignore space as a delimiter in the <item> , as here,

<keywords casesensitive="0" weakDeliminator="' '" />

the above <item> text in a document, for example,

open file for binary append as f1 

is not properly colored if preceded or succeeded by a space. All syntax coloring in the document for items is lost  if the <item> is delimited by space.








STEPS TO REPRODUCE
1.  Add 
<item>for binary append</item>
to a Kate user-defined syntax file list.
2. Open Kate, add
 open file for binary append as f1 
to an appropriate document.
3. 

OBSERVED RESULT

 for binary append 
is not colored

EXPECTED RESULT
 for binary append 
should be colored

SOFTWARE/OS VERSIONS
Windows:  10
macOS: 
Linux/KDE Plasma: Fedora 36 beta
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Jonathan Poelen 2022-07-31 16:29:29 UTC
The way keyword works is to take all the characters that are not delimiters and then search for a keyword. With > for binary append <, the string searched will be " for binary append " which has no match since there are extra spaces.

<keyword> is absolutely not made to work with delimiters present in items.

You can use <WordDetect> which only checks for delimiters at the beginning and end. In this case, you don't need to put any more spaces in weakDeliminator
Comment 2 Christoph Cullmann 2022-10-02 17:03:29 UTC
A workaround was mentioned, the behavior of the keyword stuff will not be touched for this, seems to work well enough for all our other highlightings.