Bug 300009 - LineContinue breaks pushing and popping contexts
Summary: LineContinue breaks pushing and popping contexts
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: syntax (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 308957 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-14 15:03 UTC by Andreas Nordal
Modified: 2012-10-24 21:44 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
syntax file for a testcase to demonstrate bogus LineContinue (1.42 KB, application/xml)
2012-05-14 15:11 UTC, Andreas Nordal
Details
testcase to demonstrate bogus LineContinue (375 bytes, text/plain)
2012-05-14 15:12 UTC, Andreas Nordal
Details
screenshot of testcase demonstrating bogus LineContinue (63.58 KB, image/png)
2012-05-14 15:25 UTC, Andreas Nordal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Nordal 2012-05-14 15:03:10 UTC
In syntax files for katepart, pushing N contexts on the context stack and "#pop"ing N times will normally get us back to the same context. However, if "the same context" is a continuation of the previous line due to LineContinue, it pops N+1 times. That is one too many.

Reproducible: Always

Steps to Reproduce:
I will attach a syntax file, a testcase and a screenshot to prove my "Actual Results". You can verify by:
1) Copy the syntax file into /usr/share/kde4/apps/katepart/syntax/
2) Open the testcase in Kwrite.

Actual Results:  
1) LineContinue evidently succeeds in continuing the context of the previous line.
2) Pushing and popping equally many times returns to the _same context_ when not using LineContinue.
3) Pushing and popping equally many times returns to the _parent context_ after encountering LineContinue.

Expected Results:  
LineContinue should not alter the state machine.

It seems impossible to write a syntax file for a language that has substates in a state that uses line continuations. Therefore, I think a major feature is broken.

The current behaviour is in my opinion neither logical or useful. It certainly cannot be relied on (any more than the presence of line continuations).
Comment 1 Andreas Nordal 2012-05-14 15:11:23 UTC
Created attachment 71088 [details]
syntax file for a testcase to demonstrate bogus LineContinue
Comment 2 Andreas Nordal 2012-05-14 15:12:57 UTC
Created attachment 71089 [details]
testcase to demonstrate bogus LineContinue
Comment 3 Andreas Nordal 2012-05-14 15:25:52 UTC
Created attachment 71090 [details]
screenshot of testcase demonstrating bogus LineContinue

If it was possible to upload attachments when submitting the report, a lot less emails would need to be sent…
Comment 4 Christoph Cullmann 2012-10-24 17:28:39 UTC
Git commit 5bff64eb8f040ffa1ce48545dbfaf23eab04a13c by Christoph Cullmann.
Committed on 24/10/2012 at 19:27.
Pushed by cullmann into branch 'master'.

fix typo that killed line continue behavior
this fixes that line continue messes with the highlighting stack
now it is "transparent" to the context stack

M  +1    -5    part/syntax/katehighlight.cpp

http://commits.kde.org/kate/5bff64eb8f040ffa1ce48545dbfaf23eab04a13c
Comment 5 Christoph Cullmann 2012-10-24 17:29:13 UTC
Thanks a lot for the perfect example to reproduce and fix!
Was just a copy and paste error it seems, stupid :(
Comment 6 Christoph Cullmann 2012-10-24 21:44:52 UTC
*** Bug 308957 has been marked as a duplicate of this bug. ***