<< "[ b = " << b << "]" << endl;
if (buffer_) {
+ // Save the current selection if any
+ cap::saveSelection(cursor_);
// Save the actual cursor position and anchor inside the
// buffer so that it can be restored in case we rechange
// to this buffer later on.
{
BOOST_ASSERT(&cur.bv() == this);
+ // this event will clear selection so we save selection for
+ // persistent selection
+ cap::saveSelection(cursor());
+
// Has the cursor just left the inset?
bool badcursor = false;
bool leftinset = (&cursor_.inset() != &cur.inset());
cursor_.setSelection(cursor_, -length);
} else
cursor_.setSelection(cursor_, length);
- cap::saveSelection(cursor_);
}
}
#include "Buffer.h"
#include "buffer_funcs.h"
#include "BufferParams.h"
+#include "BufferView.h"
#include "Cursor.h"
#include "debug.h"
#include "ErrorList.h"
Text * text = cur.text();
BOOST_ASSERT(text);
+ saveSelection(cur);
+
// make sure that the depth behind the selection are restored, too
recordUndoSelection(cur);
pit_type begpit = cur.selBegin().pit();
// This function is called, not when a selection is formed, but when
// a selection is cleared. Therefore, multiple keyboard selection
// will not repeatively trigger this function (bug 3877).
- if (cur.selection()) {
+ if (cur.selection()
+ && cur.selBegin() == cur.bv().cursor().selBegin()
+ && cur.selEnd() == cur.bv().cursor().selEnd()) {
LYXERR(Debug::ACTION) << BOOST_CURRENT_FUNCTION << ": `"
<< to_utf8(cur.selectionAsString(true)) << "'."
<< endl;
CursorSlice const & i1 = cur.selBegin();
CursorSlice const & i2 = cur.selEnd();
if (i1.inset().asInsetMath()) {
+ saveSelection(cur);
cur.top() = i1;
if (i1.idx() == i2.idx()) {
i1.cell().erase(i1.pos(), i2.pos());
}
// need a valid cursor. (Lgb)
cur.clearSelection();
- theSelection().haveSelection(false);
} else {
lyxerr << "can't erase this selection 1" << endl;
}