- LYXERR(Debug::ACTION) << BOOST_CURRENT_FUNCTION << ": `"
- << to_utf8(cur.selectionAsString(true)) << "'."
- << endl;
-
- if (cur.selection())
+ // 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()
+ && cur.selBegin() == cur.bv().cursor().selBegin()
+ && cur.selEnd() == cur.bv().cursor().selEnd()) {
+ LYXERR(Debug::ACTION) << BOOST_CURRENT_FUNCTION << ": `"
+ << to_utf8(cur.selectionAsString(true)) << "'."
+ << endl;