Ensure not to fold the end marker
AbandonedPublic

Authored by loh.tar on Apr 15 2019, 5:04 AM.

Details

Reviewers
cullmann
dhaumann
ngraham
Group Reviewers
KTextEditor
Summary

...to avoid a deceptive look

With recent fixes was also the closing brace folded which can cause a false look of the remaining visible code

Test Plan

Fold differend kind of code, only tested yet with

  • C/C++ where it seems to work.
  • Python seems to work too

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
loh.tar created this revision.Apr 15 2019, 5:04 AM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptApr 15 2019, 5:04 AM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
loh.tar requested review of this revision.Apr 15 2019, 5:04 AM
loh.tar updated this revision to Diff 56306.Apr 15 2019, 3:30 PM
loh.tar edited the test plan for this revision. (Show Details)
  • Adjust only on token based folding

I like the idea, its nice for e.g. if then else cascades, you get then out of stuff like

if (blockwise || range.onSingleLine()) {
    lineStart = range.start().column();
    remainingChars = range.columnWidth();
} else if (i == range.start().line()) {
    lineStart = range.start().column();
} else if (i == range.end().line()) {
    remainingChars = range.end().column();
}

if (blockwise || range.onSingleLine()) {
} else if (i == range.start().line()) {
} else if (i == range.end().line()) {
}

which is still nicely readable.

Are others ok with this, too?

For the code: Perhaps one should only adjust at all, if the ranges spans more than one line, to avoid accidents.

dhaumann accepted this revision.Apr 16 2019, 9:39 PM

Yes, I am in favor. thanks

This revision is now accepted and ready to land.Apr 16 2019, 9:39 PM
cullmann accepted this revision.Apr 19 2019, 11:31 AM

You can submit that, perhaps with the discussed checks, thanks
And happy Easter ;=)

loh.tar abandoned this revision.Apr 20 2019, 11:31 AM

Patch is part of D20606

And happy Easter ;=)

Thank you! :-)