]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Added Liviu Andronic, and modified generate_contributions.py to match what was in...
[lyx.git] / src / Text3.cpp
index 4b659d4a643b30f60c8703291ee128c7c81526d6..bcb13e1e3b17cbd8ba3c8ed0111679078b1ced16 100644 (file)
@@ -1160,6 +1160,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
                case mouse_button::button2:
                        // Middle mouse pasting.
+                       bv->mouseSetCursor(cur);
                        if (!cap::selection()) {                        
                                // There is no local selection in the current buffer, so try to
                                // paste primary selection instead.
@@ -1179,23 +1180,20 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        bv->cursor().finishUndo();
                        break;
 
-               case mouse_button::button3:
-                       if (cur.selection()) {
-                               DocIterator const selbeg = cur.selectionBegin();
-                               DocIterator const selend = cur.selectionEnd();
-                               Cursor tmpcur = cur;
-                               tm.setCursorFromCoordinates(tmpcur, cmd.x, cmd.y);
-                               // Don't do anything if we right-click a selection, a selection
-                               // context menu should popup instead.
-                               if (tmpcur < selbeg || tmpcur >= selend) {
-                                       cur.noUpdate();
-                                       return;
-                               }
+               case mouse_button::button3: {
+                       Cursor const & bvcur = cur.bv().cursor();
+                       // Don't do anything if we right-click a
+                       // selection, a context menu will popup.
+                       if (bvcur.selection() && cur >= bvcur.selectionBegin()
+                           && cur < bvcur.selectionEnd()) {
+                               cur.noUpdate();
+                               return;
                        }
-                       if (!bv->mouseSetCursor(cur, false)) {
+                       if (!bv->mouseSetCursor(cur, false))
                                cur.updateFlags(Update::SinglePar | Update::FitCursor);
-                               break;                  
-                       }
+                       break;                  
+               }
+
                default:
                        break;
                } // switch (cmd.button())
@@ -1252,10 +1250,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        // otherwise, single click does not clear persistent selection
                        // buffer.
                        if (cur.selection()) {
-                               // Finish selection.
-                               // If double click, cur is moved to the end of word by selectWord
-                               // but bvcur is current mouse position.
-                               cur.bv().cursor().selection() = true;
+                               // Finish selection. If double click,
+                               // cur is moved to the end of word by
+                               // selectWord but bvcur is current
+                               // mouse position.
+                               cur.bv().cursor().setSelection();
                        }
                        // FIXME: We could try to handle drag and drop of selection here.
                        cur.noUpdate();
@@ -1500,6 +1499,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_MATH_MATRIX:
        case LFUN_MATH_DELIM:
        case LFUN_MATH_BIGDELIM: {
+               cur.recordUndo();
                cap::replaceSelection(cur);
                cur.insert(new InsetMathHull(hullSimple));
                checkAndActivateInset(cur, true);
@@ -1693,6 +1693,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                tclass.defaultLayoutName();
                        setLayout(cur, laystr);
                        ParagraphParameters p;
+                       // FIXME If this call were replaced with one to clearParagraphParams(),
+                       // then we could get rid of this method altogether.
                        setParagraphs(cur, p);
                        // FIXME This should be simplified when InsetFloatList takes a 
                        // Buffer in its constructor.