using lyx::support::bformat;
using lyx::support::MakeAbsPath;
+using std::distance;
using std::find;
using std::string;
+using std::swap;
using std::vector;
if (find(labels.begin(),labels.end(),label) != labels.end()) {
cursor().clearSelection();
text()->setCursor(
- std::distance(text()->paragraphs().begin(), it.getPar()),
+ distance(text()->paragraphs().begin(), it.getPar()),
it.getPos());
cursor().resetAnchor();
update();
owner()->message(_("Undo"));
cursor().clearSelection();
- if (!textUndo(this))
+ if (!textUndo(*this))
owner()->message(_("No further undo information"));
update();
switchKeyMap();
owner()->message(_("Redo"));
cursor().clearSelection();
- if (!textRedo(this))
+ if (!textRedo(*this))
owner()->message(_("No further redo information"));
update();
switchKeyMap();
}
+void BufferView::setCursor(ParIterator const & par,
+ lyx::pos_type pos)
+{
+ LCursor & cur = cursor();
+ cur.reset();
+ ParIterator::PosHolder const & positions = par.positions();
+ int const last = par.size() - 1;
+ for (int i = 0; i < last; ++i)
+ (*positions[i].it)->inset->edit(cur, true);
+ cur.resetAnchor();
+ LyXText * lt = par.text(*buffer());
+ lt->setCursor(par.pit(), pos);
+}
/*
int length, bool backwards)
{
ParIterator par(cur);
-
+
cursor().clearSelection();
LyXText * text = par.text(*buffer());
- par.lockPath(this);
+ setCursor(par, cur.pos());
+
// hack for the chicken and egg problem
if (par.inset())
top_y(par.outerPar()->y);
text->setSelectionRange(length);
cursor().setSelection();
if (backwards)
- std::swap(cursor().cursor_, cursor().anchor_);
+ swap(cursor().cursor_, cursor().anchor_);
}
fitCursor();
{
return pimpl_->cursor_;
}
-