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