]> git.lyx.org Git - features.git/commitdiff
Move handling of LFUN_COPY to BufferView
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 8 Jan 2021 18:27:19 +0000 (19:27 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 8 Jan 2021 18:31:42 +0000 (19:31 +0100)
It turns out that the code is the same in texted ans mathed and that
whatever is done in InsetTabular is not useful.

This means that we do not need to deal Text::dispatch idiosyncrasies
(in particular forcing the cursor to be visible).

Fix bug #11225.

src/BufferView.cpp
src/Text3.cpp
src/insets/InsetTabular.cpp
src/mathed/InsetMathNest.cpp

index afd9ada647d399a43200a9e6ba6b6de749da034c..6735808545d8627ede8dc8f958d2ba10c1eb271b 100644 (file)
@@ -1251,6 +1251,10 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                break;
        }
 
+       case LFUN_COPY:
+               flag.setEnabled(cur.selection());
+               break;
+
        default:
                return false;
        }
@@ -2187,6 +2191,11 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                break;
        }
 
+       case LFUN_COPY:
+               cap::copySelection(cur);
+               cur.message(_("Copy"));
+               break;
+
        default:
                // OK, so try the Buffer itself...
                buffer_.dispatch(cmd, dr);
index 5e64801a6866d9b8f2f1915b9b4aea634dac5d6b..869e709635791ee5943f13903e6f7e717804d472 100644 (file)
@@ -1548,11 +1548,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                cur.message(_("Cut"));
                break;
 
-       case LFUN_COPY:
-               copySelection(cur);
-               cur.message(_("Copy"));
-               break;
-
        case LFUN_SERVER_GET_XY:
                cur.message(from_utf8(
                        convert<string>(tm->cursorX(cur.top(), cur.boundary()))
@@ -3284,7 +3279,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                break;
 
        case LFUN_CUT:
-       case LFUN_COPY:
                enable = cur.selection();
                break;
 
index b3e8bd8d49fc0d3ded5b092274490cd5081c0111..3cd8212441583ae494cc2008e790fb02814fef6f 100644 (file)
@@ -5254,16 +5254,6 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
                        cell(cur.idx())->dispatch(cur, cmd);
                break;
 
-       case LFUN_COPY:
-               if (!cur.selection())
-                       break;
-               if (cur.selIsMultiCell()) {
-                       cur.finishUndo();
-                       copySelection(cur);
-               } else
-                       cell(cur.idx())->dispatch(cur, cmd);
-               break;
-
        case LFUN_CLIPBOARD_PASTE:
        case LFUN_PRIMARY_SELECTION_PASTE: {
                docstring const clip = (act == LFUN_CLIPBOARD_PASTE) ?
index 406bd93d997bfe8f48ac2ec36330a434fc730aa7..abaeec903c6c882661ee21f1f9b6a0a2d65c62a5 100644 (file)
@@ -558,11 +558,6 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                cur.forceBufferUpdate();
                break;
 
-       case LFUN_COPY:
-               copySelection(cur);
-               cur.message(_("Copy"));
-               break;
-
        case LFUN_MOUSE_PRESS:
                lfunMousePress(cur, cmd);
                break;