docstring parbreak(Paragraph const & par)
{
- odocstringstream ods;
- ods << '\n';
+ odocstringstream os;
+ os << '\n';
// only add blank line if we're not in an ERT or Listings inset
if (par.ownerCode() != ERT_CODE
&& par.ownerCode() != LISTINGS_CODE)
- ods << '\n';
- return ods.str();
+ os << '\n';
+ return os.str();
}
} // namespace anon
new_cur.pos() = right_pos + 1;
// set the boundary to true in two situations:
if (
- // 1. if new_pos is now lastpos (which means that we're moving
- // right to the end of an LTR chunk which is at the end of an
- // RTL paragraph);
- new_cur.pos() == lastpos()
+ // 1. if new_pos is now lastpos, and we're in an RTL paragraph
+ // (this means that we're moving right to the end of an LTR chunk
+ // which is at the end of an RTL paragraph);
+ (new_cur.pos() == lastpos()
+ && paragraph().isRTL(buffer().params()))
// 2. if the position *after* right_pos is RTL (we want to be
// *after* right_pos, not before right_pos + 1!)
|| paragraph().getFontSettings(bv().buffer().params(),
new_cur.pos() = left_pos + 1;
// set the boundary to true in two situations:
if (
- // 1. if new_pos is now lastpos (which means that we're moving left
- // to the end of an RTL chunk which is at the end of an LTR
- // paragraph);
- new_cur.pos() == lastpos()
+ // 1. if new_pos is now lastpos and we're in an LTR paragraph
+ // (this means that we're moving left to the end of an RTL chunk
+ // which is at the end of an LTR paragraph);
+ (new_cur.pos() == lastpos()
+ && !paragraph().isRTL(buffer().params()))
// 2. if the position *after* left_pos is not RTL (we want to be
// *after* left_pos, not before left_pos + 1!)
|| !paragraph().getFontSettings(bv().buffer().params(),
void Cursor::setSelection()
{
- selection() = true;
+ setSelection(true);
// A selection with no contents is not a selection
// FIXME: doesnt look ok
if (idx() == anchor().idx() &&
pit() == anchor().pit() &&
pos() == anchor().pos())
- selection() = false;
+ setSelection(false);
}
void Cursor::setSelection(DocIterator const & where, int n)
{
setCursor(where);
- selection() = true;
+ setSelection(true);
anchor_ = where;
pos() += n;
}
void Cursor::clearSelection()
{
- selection() = false;
- mark() = false;
+ setSelection(false);
+ setMark(false);
resetAnchor();
}
cap::saveSelection(*this);
resetAnchor();
- selection() = sel;
+ setSelection(sel);
return true;
}
}
-void Cursor::niceInsert(docstring const & t)
+void Cursor::niceInsert(docstring const & t, Parse::flags f)
{
MathData ar;
- asArray(t, ar);
+ asArray(t, ar, f);
if (ar.size() == 1)
niceInsert(ar[0]);
else
// let's require two backspaces for 'big stuff' and
// highlight on the first
resetAnchor();
- selection() = true;
+ setSelection(true);
--pos();
} else {
--pos();
// 'clever' UI hack: only erase large items if previously slected
if (pos() != lastpos() && nextAtom()->nargs() > 0) {
resetAnchor();
- selection() = true;
+ setSelection(true);
++pos();
} else {
plainErase();
void Cursor::checkBufferStructure()
{
- if (paragraph().layout().toclevel == Layout::NOT_IN_TOC)
- return;
Buffer const * master = buffer().masterBuffer();
- master->tocBackend().updateItem(ParConstIterator(*this));
- master->structureChanged();
+ master->tocBackend().updateItem(*this);
}