#include <config.h>
#include "BufferView.h"
+#include "bufferview_funcs.h"
#include "buffer.h"
#include "cursor.h"
#include "coordcache.h"
#include "mathed/InsetMathScript.h"
#include "mathed/MathMacroTable.h"
+#include "frontends/Selection.h"
+
#include "support/limited_stack.h"
#include <boost/assert.hpp>
{
BOOST_ASSERT(!empty());
//lyxerr << "Leaving inset to the right" << endl;
+ const pos_type lp = (depth() > 1) ? (*this)[depth() - 2].lastpos() : 0;
inset().notifyCursorLeaves(*this);
if (depth() == 1)
return false;
pop();
- ++pos();
+ pos() += lastpos() - lp + 1;
return true;
}
}
-Row & LCursor::textRow()
-{
- BOOST_ASSERT(!paragraph().rows().empty());
- return paragraph().getRow(pos(), boundary());
-}
-
-
Row const & LCursor::textRow() const
{
- BOOST_ASSERT(!paragraph().rows().empty());
- return paragraph().getRow(pos(), boundary());
+ ParagraphMetrics const & pm = bv().parMetrics(text(), pit());
+ BOOST_ASSERT(!pm.rows().empty());
+ return pm.getRow(pos(), boundary());
}
resetAnchor();
selection() = sel;
+ theSelection().haveSelection(sel);
return true;
}
autocorrect() = false;
if (selection()) {
- cap::selDel(*this);
+ cap::eraseSelection(*this);
return true;
}
return true;
if (selection()) {
- cap::selDel(*this);
+ cap::eraseSelection(*this);
return true;
}
}
-string LCursor::currentState()
+docstring LCursor::currentState()
{
if (inMathed()) {
odocstringstream os;
info(os);
- return to_utf8(os.str());
+ return os.str();
}
if (inTexted())
return text()->currentState(*this);
- return string();
+ return docstring();
}