From: Guillaume Munch Date: Sun, 6 Nov 2016 14:14:29 +0000 (+0100) Subject: Always prefer breaking at word boundaries X-Git-Tag: 2.2.3~148 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=bac0780b27b688ccb000acae6bd22a8e5969d140;p=features.git Always prefer breaking at word boundaries An overlong word containing a hyphen could be broken anywhere, instead of after the hyphen. Example: compare the line breaking of aaaaa-aaaaa-aaaaa-aaaaa with aaa aaaaa-aaaaa-aaaaa-aaaaa (with a very narrow window) This also improves Chinese text in some situations (#10299) (cherry picked from commit 50ccbd2eab8cb01ff9f7c80d3fe726297dca6fae) --- diff --git a/src/frontends/qt4/GuiFontMetrics.cpp b/src/frontends/qt4/GuiFontMetrics.cpp index 1d472b5ceb..a1d5b40094 100644 --- a/src/frontends/qt4/GuiFontMetrics.cpp +++ b/src/frontends/qt4/GuiFontMetrics.cpp @@ -282,7 +282,8 @@ bool GuiFontMetrics::breakAt(docstring & s, int & x, bool const rtl, bool const tl.setText(qs); tl.setFont(font_); QTextOption to; - to.setWrapMode(force ? QTextOption::WrapAnywhere : QTextOption::WordWrap); + to.setWrapMode(force ? QTextOption::WrapAtWordBoundaryOrAnywhere + : QTextOption::WordWrap); tl.setTextOption(to); tl.beginLayout(); QTextLine line = tl.createLine(); diff --git a/status.22x b/status.22x index b9aed110db..492f08b8bf 100644 --- a/status.22x +++ b/status.22x @@ -133,6 +133,9 @@ What's new - Fix bad painting of collapsable insets sub-label when selecting (bug 10475). +- Always prefer breaking lines at word boundaries even for very long words. This + fixes line breaking issues most noticeably in languages where spaces are rare + such as Chinese (bug 10299). * INTERNALS