#include "support/lassert.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
+#include "support/textutils.h"
#include <algorithm>
#include <ostream>
isRTL(), wrap_any | force);
// if breaking did not really work, give up
- if (!force && breaks.front().wid > width) {
+ if (!force && breaks.front().nspc_wid > width) {
if (dim.wid == 0)
dim.wid = fm.width(str);
return false;
void Row::Element::rtrim()
{
- if (type != STRING)
+ if (type != STRING || str.empty() || !isSpace(str.back()))
return;
/* This is intended for strings that have been created by splitAt.
- * They may have trailing spaces, but they are not counted in the
- * string length (QTextLayout feature, actually). We remove them,
- * and decrease endpos, since spaces at row break are invisible.
+ * If There is a trailing space, we remove it and decrease endpos,
+ * since spaces at row break are invisible.
*/
- str = support::rtrim(str);
+ str.pop_back();
endpos = pos + str.length();
dim.wid = nspc_wid;
}
<< " descent: " << row.dim_.des
<< " separator: " << row.separator
<< " label_hfill: " << row.label_hfill
- << " right_boundary: " << row.right_boundary()
+ << " end_boundary: " << row.end_boundary()
<< " flushed: " << row.flushed() << "\n";
// We cannot use the operator above, unfortunately
double x = row.left_margin;