commit 9e1db65932b895778525c48d524adfad2ae37739
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Fri Jan 8 19:27:19 2021 +0100

    Move handling of LFUN_COPY to BufferView
    
    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           |    9 +++++++++
 src/Text3.cpp                |    6 ------
 src/insets/InsetTabular.cpp  |   10 ----------
 src/mathed/InsetMathNest.cpp |    5 -----
 4 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index afd9ada..6735808 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -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);
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 5e64801..869e709 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -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;
 
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index b3e8bd8..3cd8212 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -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) ?
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 406bd93..abaeec9 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -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;
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to