Bug 452964

Summary: Kate syntax coloring .xml <item> containing space
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: Robert Wishlaw <robertwishlaw>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: christoph, jonathan.poelen, walter.von.entferndt
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Syntax color example

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.