Vincent van Ravesteijn schreef:
Jürgen Spitzmüller schreef:
Vincent van Ravesteijn wrote:
Can I start backporting the fixes for the following bugs:

5998, 2034, 2213, 3706, 3918, 4177, 4509, 4952, 5390, 5435, 5458, 5944,
5948 ?

Yes. Please post the patches subsequently.

Jürgen
Patch for bug 4952.

Vincent
Index: src/CutAndPaste.cpp
===================================================================
--- src/CutAndPaste.cpp (revision 30476)
+++ src/CutAndPaste.cpp (working copy)
@@ -744,7 +744,11 @@
                copySelectionHelper(cur.buffer(), pars, par, cur.selEnd().pit(),
                        pos, cur.selEnd().pos(), 
                        cur.buffer().params().documentClassPtr(), cutstack);
-               dirtyTabularStack(false);
+
+               // Reset the dirty_tabular_stack_ flag only when something
+               // is copied to the clipboard (not to the selectionBuffer).
+               if (&cutstack == &theCuts)
+                       dirtyTabularStack(false);
        }
 
        if (cur.inMathed()) {
Index: src/insets/InsetTabular.cpp
===================================================================
--- src/insets/InsetTabular.cpp (revision 30476)
+++ src/insets/InsetTabular.cpp (working copy)
@@ -3604,8 +3604,7 @@
                                cur.recordUndoInset(DELETE_UNDO);
                                cutSelection(cur);
                        }
-               }
-               else
+               } else
                        cell(cur.idx())->dispatch(cur, cmd);
                break;
 
@@ -3664,7 +3663,8 @@
 
        case LFUN_PASTE:
                if (!tabularStackDirty()) {
-                       cell(cur.idx())->dispatch(cur, cmd);
+                       if (!cur.selIsMultiCell())
+                               cell(cur.idx())->dispatch(cur, cmd);
                        break;
                }
                if (theClipboard().isInternal() ||
@@ -4004,15 +4004,22 @@
                return true;
 
        case LFUN_PASTE:
-               if (cur.selIsMultiCell()) {
-                       status.setEnabled(false);
-                       status.message(_("You cannot paste into a multicell 
selection."));
+               if (tabularStackDirty() && theClipboard().isInternal()) {
+                       if (cur.selIsMultiCell()) {
+                               row_type rs, re;
+                               col_type cs, ce;
+                               getSelection(cur, rs, re, cs, ce);
+                               if (paste_tabular && 
paste_tabular->column_info.size() == ce - cs + 1
+                                         && paste_tabular->row_info.size() == 
re - rs + 1)
+                                       status.setEnabled(true);        
+                               else {
+                                       status.setEnabled(false);
+                                       status.message(_("Selection size should 
match clipboard content."));
+                               }
+                       } else
+                               status.setEnabled(true);
                        return true;
                }
-               if (tabularStackDirty() && theClipboard().isInternal()) {
-                       status.setEnabled(true);
-                       return true;
-               } 
                return cell(cur.idx())->getStatus(cur, cmd, status);
 
        case LFUN_INSET_MODIFY:
@@ -4844,8 +4851,15 @@
 {
        if (!paste_tabular)
                return false;
-       col_type const actcol = tabular.cellColumn(cur.idx());
-       row_type const actrow = tabular.cellRow(cur.idx());
+       col_type actcol = tabular.cellColumn(cur.idx());
+       row_type actrow = tabular.cellRow(cur.idx());
+
+       if (cur.selIsMultiCell()) {
+               row_type re;
+               col_type ce;
+               getSelection(cur, actrow, re, actcol, ce);
+       }
+
        for (row_type r1 = 0, r2 = actrow;
             r1 < paste_tabular->row_info.size() && r2 < 
tabular.row_info.size();
             ++r1, ++r2) {
@@ -4853,7 +4867,7 @@
                    c1 < paste_tabular->column_info.size() && c2 < 
tabular.column_info.size();
                    ++c1, ++c2) {
                        if (paste_tabular->isPartOfMultiColumn(r1, c1) &&
-                           tabular.isPartOfMultiColumn(r2, c2))
+                             tabular.isPartOfMultiColumn(r2, c2))
                                continue;
                        if (paste_tabular->isPartOfMultiColumn(r1, c1)) {
                                --c2;

Reply via email to