]> git.lyx.org Git - features.git/commitdiff
Always prefer breaking at word boundaries
authorGuillaume Munch <gm@lyx.org>
Sun, 6 Nov 2016 14:14:29 +0000 (15:14 +0100)
committerGuillaume Munch <gm@lyx.org>
Sun, 6 Nov 2016 14:51:22 +0000 (15:51 +0100)
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)

src/frontends/qt4/GuiFontMetrics.cpp

index 50b05ace9a62d440e16d5a013c50353d4006197c..77cda8043409223c62a0b4dc39a24d57ec1025d6 100644 (file)
@@ -303,7 +303,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();