mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-03 14:13:58 +00:00
re-enable paste in tables
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8093 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2956e084bb
commit
4003db620d
@ -761,7 +761,6 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
string const clip = bv->getClipboard();
|
||||
if (clip.empty())
|
||||
break;
|
||||
#if 0
|
||||
if (clip.find('\t') != string::npos) {
|
||||
int cols = 1;
|
||||
int rows = 1;
|
||||
@ -787,27 +786,28 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
maxCols = max(cols, maxCols);
|
||||
|
||||
paste_tabular.reset(
|
||||
new LyXTabular(bv->buffer()->params(),
|
||||
this, rows, maxCols)
|
||||
);
|
||||
new LyXTabular(bv->buffer()->params(), rows, maxCols));
|
||||
|
||||
string::size_type op = 0;
|
||||
int cell = 0;
|
||||
int cells = paste_tabular->getNumberOfCells();
|
||||
p = 0;
|
||||
cols = 0;
|
||||
LyXFont font;
|
||||
while (cell < cells && p < len &&
|
||||
(p = clip.find_first_of("\t\n", p)) != string::npos) {
|
||||
if (p >= len)
|
||||
break;
|
||||
switch (clip[p]) {
|
||||
case '\t':
|
||||
paste_tabular->getCellInset(cell)->setText(clip.substr(op, p-op));
|
||||
paste_tabular->getCellInset(cell).
|
||||
setText(clip.substr(op, p-op), font);
|
||||
++cols;
|
||||
++cell;
|
||||
break;
|
||||
case '\n':
|
||||
paste_tabular->getCellInset(cell)->setText(clip.substr(op, p-op));
|
||||
paste_tabular->getCellInset(cell).
|
||||
setText(clip.substr(op, p-op), font);
|
||||
while (cols++ < maxCols)
|
||||
++cell;
|
||||
cols = 0;
|
||||
@ -818,11 +818,9 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
}
|
||||
// check for the last cell if there is no trailing '\n'
|
||||
if (cell < cells && op < len)
|
||||
paste_tabular->getCellInset(cell)->setText(clip.substr(op, len-op));
|
||||
} else
|
||||
#else
|
||||
if (!insertAsciiString(bv, clip, true))
|
||||
#endif
|
||||
paste_tabular->getCellInset(cell).
|
||||
setText(clip.substr(op, len-op), font);
|
||||
} else if (!insertAsciiString(bv, clip, true))
|
||||
{
|
||||
// so that the clipboard is used and it goes on
|
||||
// to default
|
||||
|
@ -519,31 +519,6 @@ DispatchResult InsetText::priv_dispatch(FuncRequest const & cmd,
|
||||
result.update(true);
|
||||
break;
|
||||
|
||||
case LFUN_PASTE:
|
||||
if (!autoBreakRows_) {
|
||||
if (CutAndPaste::nrOfParagraphs() > 1) {
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning FIXME horrendously bad UI
|
||||
#endif
|
||||
Alert::error(_("Paste failed"),
|
||||
_("Cannot include more than one paragraph."));
|
||||
}
|
||||
} else {
|
||||
replaceSelection(bv->getLyXText());
|
||||
size_t sel_index = 0;
|
||||
string const & arg = cmd.argument;
|
||||
if (isStrUnsignedInt(arg)) {
|
||||
#warning FIXME Check if the arg is in the domain of available selections.
|
||||
sel_index = strToUnsignedInt(arg);
|
||||
}
|
||||
text_.pasteSelection(sel_index);
|
||||
// bug 393
|
||||
text_.clearSelection();
|
||||
#warning should be also set dispatched here?
|
||||
result.update(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
if (!autoBreakRows_) {
|
||||
result.dispatched(true);
|
||||
|
Loading…
Reference in New Issue
Block a user