#include <config.h>
#include "BufferView.h"
+#include "bufferview_funcs.h"
#include "buffer.h"
#include "cursor.h"
#include "coordcache.h"
{
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 const & LCursor::textRow() const
+{
+ ParagraphMetrics const & pm = bv().parMetrics(text(), pit());
+ BOOST_ASSERT(!pm.rows().empty());
+ return pm.getRow(pos(), boundary());
+}
+
+
void LCursor::resetAnchor()
{
anchor_ = *this;
operator[](i).inset().infoize(os);
os << " ";
}
- if (pos() != 0)
- prevInset()->infoize2(os);
+ if (pos() != 0) {
+ InsetBase const * inset = prevInset();
+ // prevInset() can return 0 in certain case.
+ if (inset)
+ prevInset()->infoize2(os);
+ }
// overwite old message
os << " ";
}
resetAnchor();
selection() = sel;
+ cap::saveSelection(*this);
return true;
}
#include "mathed/InsetMathScript.h"
#include "mathed/InsetMathUnknown.h"
#include "mathed/MathFactory.h"
-#include "mathed/MathMacroArgument.h"
#include "mathed/MathStream.h"
#include "mathed/MathSupport.h"
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();
}