With ChangeLog entry...

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.224
diff -u -p -r1.224 ChangeLog
--- ChangeLog   13 May 2002 12:42:03 -0000      1.224
+++ ChangeLog   13 May 2002 15:32:49 -0000
@@ -1,6 +1,10 @@
 
 2002-05-13  André Pönitz <[EMAIL PROTECTED]>
 
+       * math_cursor.[Ch]: honor lyxrc setting for auto_delete_region
+
+2002-05-13  André Pönitz <[EMAIL PROTECTED]>
+
        * math_cursor.C: fix crash on paste as reported by Piroux Geoffroy
 
 2002-04-24  Juergen Vigna  <[EMAIL PROTECTED]>
Index: math_cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v
retrieving revision 1.259
diff -u -p -r1.259 math_cursor.C
--- math_cursor.C       13 May 2002 12:42:03 -0000      1.259
+++ math_cursor.C       13 May 2002 15:32:49 -0000
@@ -16,6 +16,7 @@
  */
 
 #include <config.h>
+#include <lyxrc.h>
 
 #ifdef __GNUG__
 #pragma implementation
@@ -436,6 +437,7 @@ void MathCursor::plainInsert(MathAtom co
 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 &
                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,12 +1490,13 @@ 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
Index: math_cursor.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.h,v
retrieving revision 1.104
diff -u -p -r1.104 math_cursor.h
--- math_cursor.h       26 Mar 2002 12:38:59 -0000      1.104
+++ math_cursor.h       13 May 2002 15:32:49 -0000
@@ -148,6 +148,8 @@ public:
        void selStart();
        ///
        void selClear();
+       /// clears or deletes selection depending on lyxrc setting
+       void selClearOrDel();
        ///
        void selGet(MathArray & ar);
        ///


Reply via email to