From 23306a5536c865979328a8675ec664b2f1572184 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 14 May 2002 09:15:40 +0000 Subject: [PATCH] autodelreg2.patch git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4156 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/ChangeLog | 3 +++ src/mathed/math_cursor.C | 25 +++++++++++++++++++------ src/mathed/math_cursor.h | 2 ++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index b0eed42098..e4bbac6090 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,6 @@ +2002-05-13 André Pönitz + + * math_cursor.[Ch]: honor lyxrc setting for auto_delete_region 2002-05-13 André Pönitz diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 8bf036a004..a68f33ce9f 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -16,6 +16,7 @@ */ #include +#include #ifdef __GNUG__ #pragma implementation @@ -436,6 +437,7 @@ void MathCursor::plainInsert(MathAtom const & t) void MathCursor::insert(char c, MathTextCodes t) { //lyxerr << "inserting '" << c << "'\n"; + selClearOrDel(); plainInsert(MathAtom(new MathCharInset(c, t))); } @@ -454,7 +456,7 @@ void MathCursor::insert(MathAtom const & t) if (t->nargs()) selCut(); else - selDel(); + selClearOrDel(); } plainInsert(t); @@ -653,7 +655,7 @@ void MathCursor::selCopy() dump("selCopy"); if (selection_) { theSelection.grab(*this); - selClear(); + //selClear(); } } @@ -686,6 +688,7 @@ void MathCursor::selDel() void MathCursor::selPaste() { dump("selPaste"); + selClearOrDel(); theSelection.paste(*this); //theSelection.grab(*this); //selClear(); @@ -720,6 +723,15 @@ void MathCursor::selClear() } +void MathCursor::selClearOrDel() +{ + if (lyxrc.auto_region_delete) + selDel(); + else + selClear(); +} + + void MathCursor::selGet(MathArray & ar) { dump("selGet"); @@ -1478,13 +1490,14 @@ bool MathCursor::interpret(char c) 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 'a' and deleting the 'a', but diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index 6d8748a203..3f03b6fa4e 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -148,6 +148,8 @@ public: void selStart(); /// void selClear(); + /// clears or deletes selection depending on lyxrc setting + void selClearOrDel(); /// void selGet(MathArray & ar); /// -- 2.39.5