mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-14 01:22:33 +00:00
branch: Fix bug #4952: Multiple cells pasting fails if cells are selected.
When the clipboard contains a tabular selection, dirty_tabular_stack_ is true. However, it is set to false when the user clears a selection (without copying). After this (mostly accidental) action, pasting the tabular contents goes wrong. So, we only clear the dirty_tabular_stack_ flag when a 'real' copy to clipboard has been made. see r29717, r29718, r29719 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@30499 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e49fed46fc
commit
4813d3ae41
@ -744,6 +744,10 @@ void copySelectionToStack(Cursor const & cur, CutStack & cutstack)
|
|||||||
copySelectionHelper(cur.buffer(), pars, par, cur.selEnd().pit(),
|
copySelectionHelper(cur.buffer(), pars, par, cur.selEnd().pit(),
|
||||||
pos, cur.selEnd().pos(),
|
pos, cur.selEnd().pos(),
|
||||||
cur.buffer().params().documentClassPtr(), cutstack);
|
cur.buffer().params().documentClassPtr(), cutstack);
|
||||||
|
|
||||||
|
// Reset the dirty_tabular_stack_ flag only when something
|
||||||
|
// is copied to the clipboard (not to the selectionBuffer).
|
||||||
|
if (&cutstack == &theCuts)
|
||||||
dirtyTabularStack(false);
|
dirtyTabularStack(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3604,8 +3604,7 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
cur.recordUndoInset(DELETE_UNDO);
|
cur.recordUndoInset(DELETE_UNDO);
|
||||||
cutSelection(cur);
|
cutSelection(cur);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
cell(cur.idx())->dispatch(cur, cmd);
|
cell(cur.idx())->dispatch(cur, cmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3664,6 +3663,7 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
case LFUN_PASTE:
|
case LFUN_PASTE:
|
||||||
if (!tabularStackDirty()) {
|
if (!tabularStackDirty()) {
|
||||||
|
if (!cur.selIsMultiCell())
|
||||||
cell(cur.idx())->dispatch(cur, cmd);
|
cell(cur.idx())->dispatch(cur, cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -4004,12 +4004,19 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case LFUN_PASTE:
|
case LFUN_PASTE:
|
||||||
if (cur.selIsMultiCell()) {
|
|
||||||
status.setEnabled(false);
|
|
||||||
status.message(_("You cannot paste into a multicell selection."));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (tabularStackDirty() && theClipboard().isInternal()) {
|
if (tabularStackDirty() && theClipboard().isInternal()) {
|
||||||
|
if (cur.selIsMultiCell()) {
|
||||||
|
row_type rs, re;
|
||||||
|
col_type cs, ce;
|
||||||
|
getSelection(cur, rs, re, cs, ce);
|
||||||
|
if (paste_tabular && paste_tabular->column_info.size() == ce - cs + 1
|
||||||
|
&& paste_tabular->row_info.size() == re - rs + 1)
|
||||||
|
status.setEnabled(true);
|
||||||
|
else {
|
||||||
|
status.setEnabled(false);
|
||||||
|
status.message(_("Selection size should match clipboard content."));
|
||||||
|
}
|
||||||
|
} else
|
||||||
status.setEnabled(true);
|
status.setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -4844,8 +4851,15 @@ bool InsetTabular::pasteClipboard(Cursor & cur)
|
|||||||
{
|
{
|
||||||
if (!paste_tabular)
|
if (!paste_tabular)
|
||||||
return false;
|
return false;
|
||||||
col_type const actcol = tabular.cellColumn(cur.idx());
|
col_type actcol = tabular.cellColumn(cur.idx());
|
||||||
row_type const actrow = tabular.cellRow(cur.idx());
|
row_type actrow = tabular.cellRow(cur.idx());
|
||||||
|
|
||||||
|
if (cur.selIsMultiCell()) {
|
||||||
|
row_type re;
|
||||||
|
col_type ce;
|
||||||
|
getSelection(cur, actrow, re, actcol, ce);
|
||||||
|
}
|
||||||
|
|
||||||
for (row_type r1 = 0, r2 = actrow;
|
for (row_type r1 = 0, r2 = actrow;
|
||||||
r1 < paste_tabular->row_info.size() && r2 < tabular.row_info.size();
|
r1 < paste_tabular->row_info.size() && r2 < tabular.row_info.size();
|
||||||
++r1, ++r2) {
|
++r1, ++r2) {
|
||||||
|
@ -192,6 +192,9 @@ What's new
|
|||||||
- Fix the toggling of the outline-button on the toolbar when closing
|
- Fix the toggling of the outline-button on the toolbar when closing
|
||||||
the outliner with the 'x' (bug 3918).
|
the outliner with the 'x' (bug 3918).
|
||||||
|
|
||||||
|
- Fix the pasting of multiple cells in a table when a range is selected
|
||||||
|
(bug 4952).
|
||||||
|
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user