Bug 457551 - Text folding is broken for multi-line comments with exactly two lines.
Summary: Text folding is broken for multi-line comments with exactly two lines.
Status: CONFIRMED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-06 12:02 UTC by Lukas Sommer
Modified: 2023-12-19 18:37 UTC (History)
2 users (show)

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


Attachments
minimal.c (156 bytes, text/x-csrc)
2022-08-06 12:02 UTC, Lukas Sommer
Details
minimal.css (181 bytes, text/css)
2022-08-06 12:02 UTC, Lukas Sommer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Sommer 2022-08-06 12:02:16 UTC
SUMMARY

Text folding is broken for multi-line comments with exactly two lines.


STEPS TO REPRODUCE
1. Open one of the attached minimal examples.
2. Hover the mouse over the folding indicator of the two-line comment.
3. Do a left-click.

OBSERVED RESULT
When hovering the mouse over the folding indicator of the tow-line comment, not only the comment itself is selected, but the whole surrounding block. When doing the left-click, this whole block is folded.

EXPECTED RESULT
It seems that for text folding, the syntax highlighting engine always keeps the first and the last line visible (which is a reasonable behaviour, given that apart from the hidden text, there might be more content on these lines that is not part of the comment and should therefore not be hidden). Given this policy, the correct behaviour for two-line comments would be to not show the folding indicator at all - just as it does currently also for multi-line comments with only one single line.

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 22.04
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.15.0-43-generic (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-7700HQ CPU @ 2.80GHz
Memory: 7.6 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 630

ADDITIONAL INFORMATION
This seems to be a general problem of the text folding implementation. It occurs across various languages and seems therefore be independent of the individual syntax files (.xml files).
Comment 1 Lukas Sommer 2022-08-06 12:02:37 UTC
Created attachment 151146 [details]
minimal.c
Comment 2 Lukas Sommer 2022-08-06 12:02:57 UTC
Created attachment 151147 [details]
minimal.css
Comment 3 Christoph Cullmann 2023-12-19 18:37:06 UTC
Yes, that should be handled better.