]> git.lyx.org Git - lyx.git/commitdiff
InsetTabular.cpp: fix #6907, patch by goriccardo
authorUwe Stöhr <uwestoehr@web.de>
Tue, 5 Oct 2010 01:14:34 +0000 (01:14 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Tue, 5 Oct 2010 01:14:34 +0000 (01:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35561 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetTabular.cpp

index b28f334fc7a4a1d6be60c669b6e95fc038df848c..90aa18d15b09f58a7d7859537bb7fe36b2a5555e 100644 (file)
@@ -1995,29 +1995,29 @@ int Tabular::TeXTopHLine(odocstream & os, row_type row, string const lang) const
                }
        } else if (row == 0) {
                for (col_type c = 0; c < ncols(); ++c) {
-                       for ( ; c < ncols() && !topline[c]; ++c) {}
-
-                       col_type offset = 0;
-                       for (col_type j = 0 ; j < c; ++j)
-                               if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
-                                       ++offset;
-
-                       //babel makes the "-" character an active one, so we have to suppress this here
-                       //see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
-                       if (lang == "slovak" || lang == "czech")
-                               os << "\\expandafter" << (use_booktabs ? "\\cmidrule" : "\\cline") 
-                                  << "\\expandafter{\\expandafter" << c + 1 + offset << "\\string-";
-                       else
-                               os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 + offset << '-';
-
-                       col_type cstart = c;
-                       for ( ; c < ncols() && topline[c]; ++c) {}
-
-                       for (col_type j = cstart ; j < c ; ++j)
-                               if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
-                                       ++offset;
-
-                       os << c + offset << "} ";
+                       if (topline[c]) {
+                               col_type offset = 0;
+                               for (col_type j = 0 ; j < c; ++j)
+                                       if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
+                                               ++offset;
+                               
+                               //babel makes the "-" character an active one, so we have to suppress this here
+                               //see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
+                               if (lang == "slovak" || lang == "czech")
+                                       os << "\\expandafter" << (use_booktabs ? "\\cmidrule" : "\\cline") 
+                                       << "\\expandafter{\\expandafter" << c + 1 + offset << "\\string-";
+                               else
+                                       os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 + offset << '-';
+                               
+                               col_type cstart = c;
+                               for ( ; c < ncols() && topline[c]; ++c) {}
+                               
+                               for (col_type j = cstart ; j < c ; ++j)
+                                       if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
+                                               ++offset;
+                               
+                               os << c + offset << "} ";
+                       }
                }
        }
        os << "\n";
@@ -2068,29 +2068,29 @@ int Tabular::TeXBottomHLine(odocstream & os, row_type row, string const lang) co
                        os << "\\hline ";
        } else {
                for (col_type c = 0; c < ncols(); ++c) {
-                       for ( ; c < ncols() && !bottomline[c]; ++c) {}
-
-                       col_type offset = 0;
-                       for (col_type j = 0 ; j < c; ++j)
-                               if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
-                                       ++offset;
-
-                       //babel makes the "-" character an active one, so we have to suppress this here
-                       //see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
-                       if (lang == "slovak" || lang == "czech")
-                               os << "\\expandafter" << (use_booktabs ? "\\cmidrule" : "\\cline") 
-                                  << "\\expandafter{\\expandafter" << c + 1 + offset << "\\string-";
-                       else
-                               os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 + offset << '-';
-
-                       col_type cstart = c;
-                       for ( ; c < ncols() && bottomline[c]; ++c) {}
-
-                       for (col_type j = cstart ; j < c ; ++j)
-                               if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
-                                       ++offset;
-
-                       os << c + offset << "} ";
+                       if (bottomline[c]) {
+                               col_type offset = 0;
+                               for (col_type j = 0 ; j < c; ++j)
+                                       if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
+                                               ++offset;
+                               
+                               //babel makes the "-" character an active one, so we have to suppress this here
+                               //see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
+                               if (lang == "slovak" || lang == "czech")
+                                       os << "\\expandafter" << (use_booktabs ? "\\cmidrule" : "\\cline")
+                                       << "\\expandafter{\\expandafter" << c + 1 + offset << "\\string-";
+                               else
+                                       os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 + offset << '-';
+                               
+                               col_type cstart = c;
+                               for ( ; c < ncols() && bottomline[c]; ++c) {}
+                               
+                               for (col_type j = cstart ; j < c ; ++j)
+                                       if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
+                                               ++offset;
+                               
+                               os << c + offset << "} ";
+                       }
                }
        }
        os << "\n";