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.

(cherry picked from commit 9e1db65932)
This commit is contained in:
Jean-Marc Lasgouttes 2021-01-08 19:27:19 +01:00
parent 1c4bc08be7
commit 9886bf96c1
5 changed files with 12 additions and 21 deletions

View File

@ -1232,6 +1232,10 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
break;
}
case LFUN_COPY:
flag.setEnabled(cur.selection());
break;
default:
return false;
}
@ -2153,6 +2157,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);

View File

@ -1483,11 +1483,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()))
@ -3118,7 +3113,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
break;
case LFUN_CUT:
case LFUN_COPY:
enable = cur.selection();
break;

View File

@ -4527,16 +4527,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) ?

View File

@ -566,11 +566,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;

View File

@ -68,6 +68,9 @@ What's new
- Fix Hebrew characters overflow in insets (bug 12030).
- Fix unwanted scrolling of window when using "copy". (bug 11225).
* INTERNALS