D27285: Add left/right indent fill (as opposed to left-only), extend indent lines to broken lines
eudoxos updated this revision to Diff 75727. eudoxos added a comment. Fix indentation lines shown spuriously when horizontal space was unsufficient for indent fill REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D27285?vs=75533&id=75727 BRANCH dynwrap-marker REVISION DETAIL https://phabricator.kde.org/D27285 AFFECTED FILES src/dialogs/katedialogs.cpp src/dialogs/textareaappearanceconfigwidget.ui src/render/katelinelayout.cpp src/render/katelinelayout.h src/render/katerenderer.cpp src/utils/kateconfig.cpp src/utils/kateconfig.h To: eudoxos, #vdg Cc: mwolff, cullmann, dhaumann, kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, sars
D27285: Add left/right indent fill (as opposed to left-only), extend indent lines to broken lines
eudoxos added a comment. Note to myself: should handle the case when width percentage disallows the indent, e.g. here: F8104336: image.png <https://phabricator.kde.org/F8104336> REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D27285 To: eudoxos, #vdg Cc: mwolff, cullmann, dhaumann, kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, sars
D27285: Add left/right indent fill (as opposed to left-only), extend indent lines to broken lines
eudoxos added a comment. (side note: I am not sure whether to use phabricator.kde.org or invent.kde.org for this. Are they complementary or orthogonal?) REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D27285 To: eudoxos, #vdg Cc: dhaumann, kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars
D27285: Add left/right indent fill (as opposed to left-only), extend indent lines to broken lines
eudoxos added a comment. > No offense meant, but even with the screenshots I still have no idea what this is about :) Good point, I somehow missed to explain the rationale for the change. :) If you are familiar with vim, this would be the `breakindent` and `breakindentopt` settings (that was my patch from 2007 which did not make it into vim until a few years back). > Can you add a before/after screenshot so we can see the visual difference? I will use this example from std::sort documentation <https://en.cppreference.com/w/cpp/algorithm/sort> which is not the most convoluted code (those changes are the most useful for deeply nested code). This is the original rendering (with narrow window to make the point) and D27238 <https://phabricator.kde.org/D27238> applied (breaking line anywhere rather than at whitespace-only): F8100695: image.png <https://phabricator.kde.org/F8100695> Note how indentation blocks, manifest from empty space left, and also vertical indentation lines, are visually damaged by the dynamic wrap fill (I call this left fill, it is left of the indentation level). Dynamic wrap is something related to presentation only, not to overall code logic (indentation), and is line-local; so the option to enable/disable this fill is to make it possible to remove this globally-prominent visual cue about something very much local. This is without the left fill (note how indentation lines now also extend vertically): F8100700: image.png <https://phabricator.kde.org/F8100700> Now, the line being wrapped does have some importance and it should be shown somewhere. It is shown already by the arrow in the left margin, but that is way too far from the break, even left from folding markers (global logic) (I understand the wrap markers are there probably from the age when dynamic wrapping did not respect indentation and it was a sin to write code beyond col 80 ;) ). So the "right fill" is **right** of the indentation level on subsequent visual lines and gives visual cue about the line being wrapped; like this (2 characters wide, that is adjustable): F8100703: image.png <https://phabricator.kde.org/F8100703> Of course, there are many options how to mark the break where it occurs, this one was just the easiest one. Onec can clutter configuration more and think of options like moving the arrow in the left margin to the line beginning, like this (this is just GIMP, not in the code) F8100706: image.png <https://phabricator.kde.org/F8100706> but I think it is better to start with something relatively simple. It is possible to enable both left and right fill (not sure why anybody would want that, but I was not sure even for the original (left) fill): F8100716: image.png <https://phabricator.kde.org/F8100716> > Also, the "fill left" and "fill right" wording is new, and not intuitively understandable for me. That is a new "terminology" I am free to adjust. Left is simply left of indentation level, right is on the right. Hope this explains somewhat. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D27285 To: eudoxos, #vdg Cc: dhaumann, kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars
D27285: Add left/right indent fill (as opposed to left-only), extend indent lines to broken lines
eudoxos added a comment. This is the current dialogue, with two new options at the bottom (the circle had horizontal spring before an unrelated option, I think it was there by accident...?!). F8099358: image.png <https://phabricator.kde.org/F8099358> REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D27285 To: eudoxos, #vdg Cc: kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D27285: Add left/right indent fill (as opposed to left-only), extend indent lines to broken lines
eudoxos updated this revision to Diff 75533. eudoxos added a comment. Rename config keys as per discussion under D27238 <https://phabricator.kde.org/D27238> REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D27285?vs=75440&id=75533 BRANCH dynwrap-marker REVISION DETAIL https://phabricator.kde.org/D27285 AFFECTED FILES src/dialogs/katedialogs.cpp src/dialogs/textareaappearanceconfigwidget.ui src/render/katelinelayout.cpp src/render/katelinelayout.h src/render/katerenderer.cpp src/utils/kateconfig.cpp src/utils/kateconfig.h To: eudoxos, #vdg Cc: kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D27238: Add an option to dynamic-break inside words
eudoxos updated this revision to Diff 75509. eudoxos added a comment. Change config key to `dynamic-word-wrap-anywhere` as suggested. CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D27238?vs=75231&id=75509 REVISION DETAIL https://phabricator.kde.org/D27238 AFFECTED FILES src/dialogs/katedialogs.cpp src/dialogs/textareaappearanceconfigwidget.ui src/render/katerenderer.cpp src/utils/kateconfig.cpp src/utils/kateconfig.h To: eudoxos, cullmann Cc: dhaumann, cullmann, kwrite-devel, kde-frameworks-devel, cent, rrosch, LeGast00n, cblack, szutmael, GB_2, domson, michaelh, ngraham, bruns, demsking, head7, kfunk, sars
D27238: Add an option to dynamic-break inside words
eudoxos added a comment. In D27238#609494 <https://phabricator.kde.org/D27238#609494>, @cullmann wrote: > I am ok with this. > Thought I would like to have a more consistent name for the config key. > We have already "dynamic-word-wrap", I would like "dynamic-word-wrap-anywhere" better than the abbreviated "dyn-wrap-anywhere" No problem. While I am at fixing that, would not "dynamic-wrap", "dynamic-wrap-anywhere", ... fit better? It is lines which are wrapped after all, not words. There might be more options like that later (working on that) and it will be harder to change later. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D27238 To: eudoxos, cullmann Cc: dhaumann, cullmann, kwrite-devel, kde-frameworks-devel, cent, rrosch, LeGast00n, cblack, szutmael, GB_2, domson, michaelh, ngraham, bruns, demsking, head7, kfunk, sars
D27238: Add an option to dynamic-break inside words
eudoxos added a comment. A complementary (also related to dynamic wrapping) change is tracked under D27285 <https://phabricator.kde.org/D27285>. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D27238 To: eudoxos Cc: dhaumann, cullmann, kwrite-devel, kde-frameworks-devel, cent, rrosch, LeGast00n, cblack, szutmael, GB_2, domson, michaelh, ngraham, bruns, demsking, head7, kfunk, sars
D27285: Add left/right indent fill (as opposed to left-only), extend indent lines to broken lines
eudoxos updated this revision to Diff 75440. eudoxos added a comment. Fix tab/space indentation, fix maximum width. No other glitches known at present. REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D27285?vs=75361&id=75440 BRANCH dynwrap-marker (branched from master) REVISION DETAIL https://phabricator.kde.org/D27285 AFFECTED FILES src/dialogs/katedialogs.cpp src/dialogs/textareaappearanceconfigwidget.ui src/render/katelinelayout.cpp src/render/katelinelayout.h src/render/katerenderer.cpp src/utils/kateconfig.cpp src/utils/kateconfig.h To: eudoxos, #vdg Cc: kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D27285: Add left/right indent fill (as opposed to left-only), extend indent lines to broken lines
eudoxos added a comment. Note: extra space (right fill) is not computed correctly if tabs are used for line indentation. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D27285 To: eudoxos, #vdg Cc: kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D27285: Add left/right indent fill (as opposed to left-only), extend indent lines to broken lines
eudoxos added a comment. This is an example with right fill of 3 characters, left fill off, with indentation lines (note that they spend all visual lines of the dynamically wrapped line). F8095407: image.png <https://phabricator.kde.org/F8095407> REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D27285 To: eudoxos, #vdg Cc: kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D27285: Add left/right indent fill (as opposed to left-only), extend indent lines to broken lines
eudoxos created this revision. eudoxos added a reviewer: VDG. Herald added projects: Kate, Frameworks. Herald added subscribers: kde-frameworks-devel, kwrite-devel. eudoxos requested review of this revision. REVISION SUMMARY The configuration UI is somewhat clumsy, some better arrangement suggestion would be welcome. There are still more options on the radar, such as showing the "broken-line" character also optionally indented (now is shown left with line numbers) and others. REPOSITORY R39 KTextEditor BRANCH dynwrap-marker (branched from master) REVISION DETAIL https://phabricator.kde.org/D27285 AFFECTED FILES src/dialogs/katedialogs.cpp src/dialogs/textareaappearanceconfigwidget.ui src/render/katelinelayout.cpp src/render/katelinelayout.h src/render/katerenderer.cpp src/utils/kateconfig.cpp src/utils/kateconfig.h To: eudoxos, #vdg Cc: kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D27238: Add an option to dynamic-break inside words
eudoxos created this revision. eudoxos added a project: KTextEditor. Herald added projects: Kate, Frameworks. Herald added subscribers: kde-frameworks-devel, kwrite-devel. eudoxos requested review of this revision. REVISION SUMMARY Add option to break lines longer than view width (or static boundary, when dynamic-wrapping at static boundary) anywhere. It merely sets QTextOption::WrapAnywhere for the view, plus exposes that as checkbox in the config and key for saving the configuration. `QTextOption::WrapAtWordBoundaryOrAnywhere` is unfortunately very dumb, splitting at space only; while this might be ok for natural languages, it is not suitable for code: e.g. `if(eng->option.wrapMode()==QTextOption::WrapAtWordBoundaryOrAnywhere){` has no "word boundary" according the the algorithm. FYI `QTtextLayout` internally uses `QTextEngine::itemize()` [https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/text/qtextengine.cpp?h=dev#n2057](link). This patch makes a difference also for long lines "without word boundary" which should break anywhere as fallback (as per Qt's docs); in this fallback case, though ktextedit inserts zero-length line at the beginning (this is likely an existing but in ktextedit). Without breaking anywhere (old behavior, the default): F8091831: image.png <https://phabricator.kde.org/F8091831> breaking anywhere: F8091828: image.png <https://phabricator.kde.org/F8091828> (My first contribution here.) REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D27238 AFFECTED FILES src/dialogs/katedialogs.cpp src/dialogs/textareaappearanceconfigwidget.ui src/render/katerenderer.cpp src/utils/kateconfig.cpp src/utils/kateconfig.h To: eudoxos Cc: kwrite-devel, kde-frameworks-devel, cent, rrosch, LeGast00n, cblack, szutmael, GB_2, domson, michaelh, ngraham, bruns, demsking, head7, cullmann, kfunk, sars, dhaumann