]> git.lyx.org Git - features.git/commitdiff
autodelreg2.patch
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 14 May 2002 09:15:40 +0000 (09:15 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 14 May 2002 09:15:40 +0000 (09:15 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4156 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/math_cursor.C
src/mathed/math_cursor.h

index b0eed42098d063b43ec47beff02f405b212ebe9f..e4bbac6090d3aec509996ce87edbd7f6de2f7c4c 100644 (file)
@@ -1,3 +1,6 @@
+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>
 
index 8bf036a004c6eb7bb42493911d7cceb9b57b6c32..a68f33ce9f43566e5a9a75738988fa327f162d83 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <config.h>
+#include <lyxrc.h>
 
 #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  '<space>a<space>' and deleting the 'a', but
index 6d8748a20377fabd78ec40a1b1473b788c280604..3f03b6fa4e19e3d367bf3b2df3891648f5f72fc1 100644 (file)
@@ -148,6 +148,8 @@ public:
        void selStart();
        ///
        void selClear();
+       /// clears or deletes selection depending on lyxrc setting
+       void selClearOrDel();
        ///
        void selGet(MathArray & ar);
        ///