+2002-05-13 André Pönitz <poenitz@gmx.net>
+
+ * math_cursor.[Ch]: honor lyxrc setting for auto_delete_region
2002-05-13 André Pönitz <poenitz@gmx.net>
*/
#include <config.h>
+#include <lyxrc.h>
#ifdef __GNUG__
#pragma implementation
void MathCursor::insert(char c, MathTextCodes t)
{
//lyxerr << "inserting '" << c << "'\n";
+ selClearOrDel();
plainInsert(MathAtom(new MathCharInset(c, t)));
}
if (t->nargs())
selCut();
else
- selDel();
+ selClearOrDel();
}
plainInsert(t);
dump("selCopy");
if (selection_) {
theSelection.grab(*this);
- selClear();
+ //selClear();
}
}
void MathCursor::selPaste()
{
dump("selPaste");
+ selClearOrDel();
theSelection.paste(*this);
//theSelection.grab(*this);
//selClear();
}
+void MathCursor::selClearOrDel()
+{
+ if (lyxrc.auto_region_delete)
+ selDel();
+ else
+ selClear();
+}
+
+
void MathCursor::selGet(MathArray & ar)
{
dump("selGet");
return true;
}
- if (selection_) {
+ // just clear selection on pressing the space par
+ if (selection_ && c == ' ') {
selClear();
- if (c == ' ')
- return true;
- // fall through in the other cases
+ return true;
}
+ selClearOrDel();
+
if (lastcode_ == LM_TC_TEXTRM || par()->asBoxInset()) {
// suppress direct insertion of two spaces in a row
// the still allows typing '<space>a<space>' and deleting the 'a', but