the status quo fixes, I'll send a proposal how to proceed soon.
* src/CutAndPaste.[Ch]
(copySelection): Split into copySelection and copySelectionToStack
* src/text3.C
(LyXText::dispatch): Use copySelectionToStack instead of LFUN_COPY
to copy the selection to the cut buffer for two reasons:
- LFUN_COPY did not work (probably because bv.cursor() was not yet set)
- If it would work it would put the selection to the system clipboard
which is clearly wrong.
Document why we put the selection to the stack.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16534
a592a061-630c-0410-9148-
cb99ea01b6c8
// stuff the selection onto the X clipboard, from an explicit copy request
theClipboard().put(cur.selectionAsString(true));
// stuff the selection onto the X clipboard, from an explicit copy request
theClipboard().put(cur.selectionAsString(true));
+ copySelectionToStack(cur);
+}
+
+
+void copySelectionToStack(LCursor & cur)
+{
// this doesn't make sense, if there is no selection
if (!cur.selection())
return;
// this doesn't make sense, if there is no selection
if (!cur.selection())
return;
void cutSelection(LCursor & cur, bool doclear = true, bool realcut = true);
/// Push the current selection to the cut buffer and the system clipboard.
void copySelection(LCursor & cur);
void cutSelection(LCursor & cur, bool doclear = true, bool realcut = true);
/// Push the current selection to the cut buffer and the system clipboard.
void copySelection(LCursor & cur);
+/// Push the current selection to the cut buffer.
+void copySelectionToStack(LCursor & cur);
/// Paste the sel_index-th element of the cut buffer.
/// Does handle undo. Does only work in text, not mathed.
void pasteSelection(LCursor & cur, ErrorList &, size_t sel_index = 0);
/// Paste the sel_index-th element of the cut buffer.
/// Does handle undo. Does only work in text, not mathed.
void pasteSelection(LCursor & cur, ErrorList &, size_t sel_index = 0);
// we have to check this first
bool paste_internally = false;
if (cmd.button() == mouse_button::button2 && cur.selection()) {
// we have to check this first
bool paste_internally = false;
if (cmd.button() == mouse_button::button2 && cur.selection()) {
- lyx::dispatch(FuncRequest(LFUN_COPY));
+ // Copy the selection to the clipboard stack. This
+ // is done for two reasons:
+ // - We want it to appear in the "Edit->Paste recent"
+ // menu.
+ // - We can then use the normal copy/paste machinery
+ // instead of theSelection().get() to preserve
+ // formatting of the pasted stuff.
+ cap::copySelectionToStack(cur.bv().cursor());
paste_internally = true;
}
paste_internally = true;
}