Bug 463012

Summary: Folding Marker displayed even when folding region too small to fold
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: chris.m.geroux
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: 5.101.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description chris.m.geroux 2022-12-13 16:04:45 UTC
SUMMARY
During character based folding, fold start markers are identified and displayed for small one-line folding regions, however, they don't actually fold those regions.

STEPS TO REPRODUCE
An example in a c-style language

void myFunction(){
}

This will display a code fold marker (the small triangle icon on the left hand boarder) however, will not actually fold the function.

This probably doesn't come up too much in c-style languages because you probably wouldn't have an empty function. However in python I would expect the following is quite common:

def myFunction():
    ''' Some documentation about my function
    '''

    lines of function that do things ...

The doc string in between the two sets of triple quotes " ''' " will display a code folding marker. In addition a code folding marker will be displayed for the "def myFunction ():" line also. However, the folding marker on the two line doc string will not actually fold that section. More over, trying to click the code fold marker for the doc string will fold the whole body of the function. This can cause a fair amount of confusion about what is going on as the user would likely expect the lower line of the doc string the " ''' " to fold up.

Choosing not to fold small one-line regions like this isn't at all a problem. However, preferably in this case the code fold marker for the region wouldn't be displayed as that region can't actually be folded and a believe that is the desired behaviour.

SOFTWARE/OS VERSIONS
This behaviour was experienced on Ubuntu 22, with Kate version 23.03.70. However, I would expect similar behaviour on any platform.
Comment 1 Christoph Cullmann 2024-03-15 20:00:02 UTC
Hovering over the marker will still highlight the range, therefore I don't think removing them is a good idea.

The issue that the folding folds the wrong range is tracked in bug 374570.

*** This bug has been marked as a duplicate of bug 374570 ***