namespace {
-int numberOfSeparators(Row const & row)
-{
- int n = 0;
- Row::const_iterator cit = row.begin();
- Row::const_iterator const end = row.end();
- for ( ; cit != end ; ++cit)
- if (cit->type == Row::SEPARATOR)
- ++n;
- return n;
-}
-
-
-void setSeparatorWidth(Row & row, double w)
-{
- row.separator = w;
- Row::iterator it = row.begin();
- Row::iterator const end = row.end();
- for ( ; it != end ; ++it)
- if (it->type == Row::SEPARATOR)
- it->extra = w;
-}
-
int numberOfLabelHfills(Paragraph const & par, Row const & row)
{
// set x how you need it
switch (getAlign(par, row.pos())) {
case LYX_ALIGN_BLOCK: {
- int const ns = numberOfSeparators(row);
+ int const ns = row.countSeparators();
/** If we have separators, and this row has
* not be broken abruptly by a display inset
* or newline, then stretch it */
if (ns && !row.right_boundary()
&& row.endpos() != par.size()) {
- setSeparatorWidth(row, double(w) / ns);
+ row.setSeparatorExtraWidth(double(w) / ns);
row.dimension().wid = width;
} else if (text_->isRTL(par)) {
row.dimension().wid = width;
// or the end of the par, then build a representation of the row.
pos_type i = pos;
FontIterator fi = FontIterator(*this, par, pit, pos);
- while (i < end && row.width() < width) {
+ while (i < end && row.width() <= width) {
char_type c = par.getChar(i);
// The most special cases are handled first.
if (par.isInset(i)) {
int const add = max(fm.width(par.layout().labelsep),
labelEnd(pit) - row.width());
row.addSpace(i, add, *fi, par.lookupChange(i));
- } else if (par.isLineSeparator(i)) {
- // In theory, no inset has this property. If
- // this is done, a new addSeparator which
- // takes an inset as parameter should be
- // added.
- LATTEST(!par.isInset(i));
- row.addSeparator(i, c, *fi, par.lookupChange(i));
} else if (c == '\t')
row.addSpace(i, theFontMetrics(*fi).width(from_ascii(" ")),
*fi, par.lookupChange(i));
// make sure that the RTL elements are in reverse ordering
row.reverseRTL(is_rtl);
+ //LYXERR0("breakrow: row is " << row);
}
pos_type TextMetrics::getPosNearX(Row const & row, int & x,
bool & boundary) const
{
+ //LYXERR0("getPosNearX(" << x << ") row=" << row);
/// For the main Text, it is possible that this pit is not
/// yet in the CoordCache when moving cursor up.
/// x Paragraph coordinate is always 0 for main text anyway.
*/
else if (pos == cit->endpos
&& cit + 1 != row.end()
- && cit->font.isVisibleRightToLeft() != (cit + 1)->font.isVisibleRightToLeft())
+ && cit->isRTL() != (cit + 1)->isRTL())
boundary = true;
}
boundary = true;
x += xo;
+ //LYXERR0("getPosNearX ==> pos=" << pos << ", boundary=" << boundary);
return pos;
}