D19999: Fix endRegion folding in rules with beginRegion+endRegion (use length=0)

rhkramer at gmail.com rhkramer at gmail.com
Sat Mar 23 17:24:09 GMT 2019


I don't fully understand the proposed change, but I'd like to ask that we 
proceed with a little bit of caution -- this may or may not be related to a 
bug that was submitted on the order of 10 years ago and somewhat later (5 
years later) claimed to be fixed, but the fix never "worked for me".

(Background: I wrote a highlighting / folding XML file for a file format that I 
use, sort of a combination of an mbox file and TWiki (Foswiki markup) on the 
order of 10 or more years ago.  I could not get it to work properly, because 
many "markups" that would represent the end of one folding region had to also 
represent the beginning of a new folding region.  The problem (to the best of 
my recollection and non-technically correct terminology) was that the markup 
representing the end of a folding region was "consumed" by the rule to end a 
region, and was not available to start the next folding region.)

(Aside: I had plans of "publishing" that XML file as part of a mashup 
application I've been working on, but have not got that far yet.)  ;-(

I did two things -- 

   1. I filed a bug (which, iirc, was similar to one or more other bugs, and I 
either added my complaint to that bug, or somebody else recognized several 
bugs as duplicates and combined them).  Several years (3 to 5??) the bug was 
marked as fixed, but I didn't test it at that time because the resolution was 
for a version of kate which was not supported on my Debian (Wheezy, iirc) 
system.  Eventually, I installed a later version of Debian (Jessie) which 
included a later version of kate which incorporated the bug fix.  But, when I 
tried to make use of the new kate (with appropriate, I thought) revisions to 
my XML file, I could not get it to work.  I do not know if that was because:

   * the bug fix really wasn't a fix for my problem
   * the bug fix did fix my problem, but some other change in kate negated that 
fix
   * I had (forgotten) so much about how to make the XML file work that I was 
doing something wrong when I tried to accomodate the fix

   2. I added ending markup as a workaround.

Anyway, I'm going to look in my records to find the bug number -- I guess I'm 
just hoping that this fix does not make my situation any worse.



On Saturday, March 23, 2019 10:22:29 AM Nibaldo González wrote:
> nibags created this revision.
> Herald added projects: Kate, Frameworks.
> Herald added subscribers: kde-frameworks-devel, kwrite-devel.
> nibags requested review of this revision.
> 
> REVISION SUMMARY
>   BUG: 405585
> 
>   There is a problem of folding in rules with beginRegion + endRegion.
> 
>   Example:
> 
>     xml
>     <StringDetect String="hello" endRegion="region1" beginRegion="region2"
> />
> 
>   In this case, the "hello" string is part of the "region1" and "region2"
> regions simultaneously, which generates folding problems. The ideal
> behavior is that "hello" isn't part of "region1", but of "region2". That
> is, don't publish length of endRegion folding in rules with
> beginRegion+endRegion.
> 
>   The following XML files use rules with beginRegion + endRegion:
> 
>     ansforth94.xml apparmor.xml asciidoc.xml asp.xml c.xml cisco.xml
> desktop.xml fortran.xml haml.xml ini.xml isocpp.xml julia.xml lex.xml
> lua.xml makefile.xml perl.xml pony.xml rhtml.xml rpmspec.xml ruby.xml
> template-toolkit.xml txt2tags.xml yacc.xml
> 
> REPOSITORY
>   R216 Syntax Highlighting
> 
> BRANCH
>   folding-endRegion-beginRegion
> 
> REVISION DETAIL
>   https://phabricator.kde.org/D19999
> 
> AFFECTED FILES
>   autotests/folding/Makefile.fold
>   autotests/folding/folding.cpp.fold
>   autotests/folding/highlight.asp.fold
>   autotests/folding/highlight.cpp.fold
>   autotests/folding/highlight.f90.fold
>   autotests/folding/highlight.lex.fold
>   autotests/folding/highlight.pl.fold
>   autotests/folding/highlight.pony.fold
>   autotests/folding/highlight.prg.fold
>   autotests/folding/highlight.rb.fold
>   autotests/folding/highlight.spec.fold
>   autotests/folding/highlight.t2t.fold
>   autotests/folding/highlight.y.fold
>   autotests/folding/test.desktop.fold
>   autotests/folding/test.ini.fold
>   autotests/folding/usr.bin.apparmor-profile-test.fold
>   autotests/html/test.desktop.html
>   autotests/input/test.desktop
>   autotests/reference/test.desktop.ref
>   src/lib/abstracthighlighter.cpp
> 
> To: nibags
> Cc: kwrite-devel, kde-frameworks-devel, gennad, domson, michaelh, ngraham,
> bruns, demsking, cullmann, sars, dhaumann


More information about the KWrite-Devel mailing list