// The most common case is handled first (Asger)
if (IsPrintable(c)) {
- if (font.language()->RightToLeft()) {
+ if (!font.language()->RightToLeft()) {
if ((lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
lyxrc.font_norm_type == LyXRC::ISO_10646_1)
&& font.language()->lang() == "arabic") {
lyx::pos_type LyXText::log2vis(lyx::pos_type pos) const
{
- if (bidi_start == -1)
- return pos;
- else
- return log2vis_list[pos - bidi_start];
+ return (bidi_start == -1) ? pos : log2vis_list[pos - bidi_start];
}
lyx::pos_type LyXText::vis2log(lyx::pos_type pos) const
{
- if (bidi_start == -1)
- return pos;
- else
- return vis2log_list[pos - bidi_start];
+ return (bidi_start == -1) ? pos : vis2log_list[pos - bidi_start];
}
lyx::pos_type LyXText::bidi_level(lyx::pos_type pos) const
{
- if (bidi_start == -1)
- return 0;
- else
- return bidi_levels[pos - bidi_start];
+ return (bidi_start == -1) ? 0 : bidi_levels[pos - bidi_start];
}
bool LyXText::bidi_InRange(lyx::pos_type pos) const
{
- return bidi_start == -1 ||
- (bidi_start <= pos && pos <= bidi_end);
+ return bidi_start == -1 || (bidi_start <= pos && pos <= bidi_end);
}
is_space = false;
}
-
bool new_rtl = font.isVisibleRightToLeft();
bool new_rtl0 = font.isRightToLeft();
int new_level;
return false;
if (!bidi_InRange(pos - 1)) {
- /// This can happen if pos is the first char of a row.
- /// Returning false in this case is incorrect!
+ // This can happen if pos is the first char of a row.
+ // Returning false in this case is incorrect!
return false;
}
prev->getLabelWidthString() == pit->getLabelWidthString())
{
layoutasc = (layout->itemsep * defaultRowHeight());
-// } else if (rit != firstRow()) {
} else if (pit != ownerParagraphs().begin() || row.pos() != 0) {
tmptop = layout->topsep;
// par, does not end in newline, and is not row above a
// display inset... then stretch it
if (ns
- && next_row != pit->rows.end()
+ && rit->end() < pit->size()
&& !pit->isNewline(next_row->pos() - 1)
&& !disp_inset
) {
WordLangTuple const LyXText::selectNextWordToSpellcheck(float & value)
{
if (the_locking_inset) {
- WordLangTuple word = the_locking_inset->selectNextWordToSpellcheck(bv(), value);
+ WordLangTuple word =
+ the_locking_inset->selectNextWordToSpellcheck(bv(), value);
if (!word.word().empty()) {
value += float(cursor.y());
value /= float(height);
// Finally, we copy the word to a string and return it
string str;
if (selection.cursor.pos() < cursor.pos()) {
- pos_type i;
- for (i = selection.cursor.pos(); i < cursor.pos(); ++i) {
+ for (pos_type i = selection.cursor.pos(); i < cursor.pos(); ++i) {
if (!cursorPar()->isInset(i))
str += cursorPar()->getChar(i);
}
selection.cursor = cursor;
cursor = tmpcursor;
setSelection();
-
- // Great, CutSelection() gets rid of multiple spaces.
cutSelection(true, false);
}
}
z = rowBreakPoint(pit, row) + 1;
row.end(z);
pit->rows.push_back(row);
- }
-
- RowList::iterator rit = pit->rows.begin();
- RowList::iterator end = pit->rows.end();
- for (rit = pit->rows.begin(); rit != end; ++rit) {
+ RowList::iterator rit = boost::prior(pit->rows.end());
int const f = fill(pit, *rit, ww);
int const w = ww - f;
par_width = std::max(par_width, w);
void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
{
- //lyxerr << "LyXText::metrics: width: " << mi.base.textwidth
- // << " workWidth: " << workWidth() << endl;
+ lyxerr << "LyXText::metrics: width: " << mi.base.textwidth
+ << " workWidth: " << workWidth() << "\nfont: " << mi.base.font << endl;
//BOOST_ASSERT(mi.base.textwidth);
// rebuild row cache