<table><tr><td style="">eudoxos created this revision.<br />eudoxos added a project: KTextEditor.<br />Herald added projects: Kate, Frameworks.<br />Herald added subscribers: kde-frameworks-devel, kwrite-devel.<br />eudoxos requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D27238">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>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.</p>
<p><tt style="background: #ebebeb; font-size: 13px;">QTextOption::WrapAtWordBoundaryOrAnywhere</tt> is unfortunately very dumb, splitting at space only; while this might be ok for natural languages, it is not suitable for code: e.g. <tt style="background: #ebebeb; font-size: 13px;">if(eng->option.wrapMode()==QTextOption::WrapAtWordBoundaryOrAnywhere){</tt> has no "word boundary" according the the algorithm. FYI <tt style="background: #ebebeb; font-size: 13px;">QTtextLayout</tt> internally uses <tt style="background: #ebebeb; font-size: 13px;">QTextEngine::itemize()</tt> [<a href="https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/text/qtextengine.cpp?h=dev#n2057](link)" class="remarkup-link" target="_blank" rel="noreferrer">https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/text/qtextengine.cpp?h=dev#n2057](link)</a>.</p>
<p>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).</p>
<p>Without breaking anywhere (old behavior, the default):<br />
<a href="https://phabricator.kde.org/F8091831" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">F8091831: image.png</a></p>
<p>breaking anywhere:<br />
<a href="https://phabricator.kde.org/F8091828" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">F8091828: image.png</a></p>
<p>(My first contribution here.)</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R39 KTextEditor</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D27238">https://phabricator.kde.org/D27238</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/dialogs/katedialogs.cpp<br />
src/dialogs/textareaappearanceconfigwidget.ui<br />
src/render/katerenderer.cpp<br />
src/utils/kateconfig.cpp<br />
src/utils/kateconfig.h</div></div></div><br /><div><strong>To: </strong>eudoxos<br /><strong>Cc: </strong>kwrite-devel, kde-frameworks-devel, cent, rrosch, LeGast00n, cblack, szutmael, GB_2, domson, michaelh, ngraham, bruns, demsking, head7, cullmann, kfunk, sars, dhaumann<br /></div>