if ((row == 0 && nset == 0) || (row > 0 && nset != ncols()))
return;
+ // Is this the actual first row (excluding longtable caption row)?
+ bool const realfirstrow = (row == 0
+ || (is_long_tabular && row == 1 && ltCaption(0)));
+
// only output complete row lines and the 1st row's clines
if (nset == ncols() && !have_trims) {
if (use_booktabs) {
- os << (row == 0 ? "\\toprule " : "\\midrule ");
+ os << (realfirstrow ? "\\toprule " : "\\midrule ");
} else {
os << "\\hline ";
}
- } else if (row == 0 || have_trims) {
+ } else if (realfirstrow || have_trims) {
string const cline = use_booktabs ? "\\cmidrule" : "\\cline";
for (auto & c : columns) {
if (topline.find(c)->second) {
// Top
bool drawline = tabular.topLine(cell)
|| (row > 0 && tabular.bottomLine(tabular.cellAbove(cell)));
- bool heavy = tabular.use_booktabs && row == 0 && tabular.rowTopLine(row);
+ bool heavy = tabular.use_booktabs
+ && (row == 0 || (tabular.is_long_tabular && row == 1 && tabular.ltCaption(0)))
+ && tabular.rowTopLine(row);
if (tabular.topLineTrim(cell).first
|| (row > 0 && tabular.bottomLineTrim(tabular.cellIndex(row - 1, col)).first))
lt = 10;
case LFUN_PASTE:
if (!tabularStackDirty()) {
+ // Check if we have plain text or HTML with rows/columns.
+ // and if so, pass over to LFUN_CLIPBOARD_PASTE
+ if (theClipboard().hasTextContents(Clipboard::AnyTextType)
+ && !theClipboard().hasTextContents(Clipboard::LyXTextType)) {
+ docstring const clip =
+ theClipboard().getAsText(Clipboard::AnyTextType);
+ if (clip.find_first_of(from_ascii("\t\n")) != docstring::npos) {
+ FuncRequest ncmd = FuncRequest(LFUN_CLIPBOARD_PASTE, cmd.argument());
+ doDispatch(cur, ncmd);
+ break;
+ }
+ }
if (!cur.selIsMultiCell())
cell(cur.idx())->dispatch(cur, cmd);
break;
}
size_t op = 0;
- idx_type const cells = loctab->numberofcells;
+ idx_type cells = loctab->numberofcells;
p = 0;
cols = ocol;
rows = loctab->nrows();
- col_type const columns = loctab->ncols();
+ col_type columns = loctab->ncols();
- while (cell < cells && p < len && row < rows &&
+ while (p < len &&
(p = buf.find_first_of(from_ascii("\t\n"), p)) != docstring::npos)
{
if (p >= len)
break;
switch (buf[p]) {
case '\t':
- // we can only set this if we are not too far right
+ // append column if necessary
+ if (cols == columns) {
+ loctab->appendColumn(cols - 1);
+ columns = loctab->ncols();
+ cells = loctab->numberofcells;
+ ++cell;
+ }
if (cols < columns) {
shared_ptr<InsetTableCell> inset = loctab->cellInset(cell);
Font const font = bv.textMetrics(&inset->text()).
}
cols = ocol;
++row;
+ // append row if necessary
+ if (row == rows && p < len - 1) {
+ loctab->appendRow(row - 1);
+ rows = loctab->nrows();
+ cells = loctab->numberofcells;
+ }
if (row < rows)
cell = loctab->cellIndex(row, cols);
break;