From 1538facded3a58404c4039ca6660f1b80b220ea5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 15 Aug 2002 18:04:01 +0000 Subject: [PATCH] multicolumn improvemnt git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5004 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_gridinset.C | 10 +++++++--- src/mathed/math_gridinset.h | 2 +- src/mathed/math_parser.C | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index 7de23595a1..57a30f4e41 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -534,9 +534,9 @@ string MathGridInset::eolString(row_type row, bool fragile) const } -string MathGridInset::eocString(col_type col) const +string MathGridInset::eocString(col_type col, col_type lastcol) const { - if (col + 1 == ncols()) + if (col + 1 == lastcol) return string(); return " & "; } @@ -864,8 +864,12 @@ void MathGridInset::write(WriteStream & os) const for (row_type row = 0; row < nrows(); ++row) { os << verboseHLine(rowinfo_[row].lines_); // don't write & and empty cells at end of line + col_type lastcol = 0; for (col_type col = 0; col < ncols(); ++col) - os << cell(index(row, col)) << eocString(col); + if (!cell(index(row, col)).empty()) + lastcol = col + 1; + for (col_type col = 0; col < lastcol; ++col) + os << cell(index(row, col)) << eocString(col, lastcol); os << eolString(row, os.fragile()); } string const s = verboseHLine(rowinfo_[nrows()].lines_); diff --git a/src/mathed/math_gridinset.h b/src/mathed/math_gridinset.h index cef894035a..808735a29f 100644 --- a/src/mathed/math_gridinset.h +++ b/src/mathed/math_gridinset.h @@ -218,7 +218,7 @@ protected: /// returns proper 'end of line' code for LaTeX virtual string eolString(row_type row, bool fragile = false) const; /// returns proper 'end of column' code for LaTeX - virtual string eocString(col_type col) const; + virtual string eocString(col_type col, col_type lastcol) const; /// extract number of columns from alignment string col_type guessColumns(string const & halign) const; /// splits cells and shifts right part to the next cell diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 0ea4cee7c2..36b2791168 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -853,7 +853,7 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, cell = &grid.cell(grid.index(cellrow, cellcol)); } -#if 1 +#if 0 else if (t.cs() == "multicolumn") { // extract column count and insert dummy cells MathArray count; -- 2.39.5