]> git.lyx.org Git - features.git/commitdiff
Fix bug 5146. The problem arose when attempting to paste normal text into
authorRichard Heck <rgheck@comcast.net>
Fri, 8 Aug 2008 17:28:25 +0000 (17:28 +0000)
committerRichard Heck <rgheck@comcast.net>
Fri, 8 Aug 2008 17:28:25 +0000 (17:28 +0000)
a multicell selection. But the more I thought about this, the more it seemed
that pasting into multicell selections shouldn't be allowed. What exactly
ought to happen if the user selects a 2x3 grid of cells and then tries to
paste a 5x5 group of cells? LyX, anyway, just ignores the selection in this
case, which is not what the user will expect. So let's just not go there.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26099 a592a061-630c-0410-9148-cb99ea01b6c8

lib/doc/UserGuide.lyx
src/Text3.cpp
src/insets/InsetTabular.cpp

index 9c2b4297527302a6a3e26ae624e6148aba687f4c..fd1562049357a39a15f22a0c4ec9b1745c49763c 100644 (file)
@@ -19164,6 +19164,25 @@ This is a multiline entry in a table.
 \begin_layout Standard
 Cutting and pasting between tables and table cells works reasonably well.
  You can cut and paste even more than one row.
+\begin_inset Foot
+status open
+
+\begin_layout Plain Layout
+Note, however, that you cannot paste into a multicell selection.
+ The reason is that it is simply not clear what LyX should do in this case.
+ If you select a 2x3 group of cells but paste just the word 
+\begin_inset Quotes eld
+\end_inset
+
+the
+\begin_inset Quotes erd
+\end_inset
+
+ (or a 3x5 group of cells) what should happen? 
+\end_layout
+
+\end_inset
+
  Selection with the mouse or with 
 \family sans
 Shift
index be8e80feb43e2d8c7c65945dad1c3d5861f20309..ff971cb0b51a760103b94725f001ef9916012f84 100644 (file)
@@ -931,6 +931,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_PASTE: {
                cur.message(_("Paste"));
+               LASSERT(cur.selBegin().idx() == cur.selEnd().idx(), /**/);
                cap::replaceSelection(cur);
 
                // without argument?
index e30af383821e9467f127e02667d2e18fe83739f7..22237df636d0c342ff83962da54a5932cc489c72 100644 (file)
@@ -3754,11 +3754,16 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
        }
 
        case LFUN_PASTE:
+               if (cur.selBegin().idx() != cur.selEnd().idx()) {
+                       status.setEnabled(false);
+                       status.message(_("You cannot paste into a multicell selection."));
+                       return true;
+               }
                if (tabularStackDirty() && theClipboard().isInternal()) {
                        status.setEnabled(true);
                        return true;
-               } else
-                       return cell(cur.idx())->getStatus(cur, cmd, status);
+               } 
+               return cell(cur.idx())->getStatus(cur, cmd, status);
 
        case LFUN_INSET_MODIFY:
                if (insetCode(cmd.getArg(0)) == TABULAR_CODE) {