commit a3c17cfa209e28f0cc7c43a90f221deb38b7c065
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri May 2 12:35:49 2025 +0200

    Fix cmidrule trimming in last column (#13171)
---
 src/insets/InsetTabular.cpp | 29 ++++++++++++-----------------
 status.24x                  |  2 ++
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index f8feec922d..838008fda9 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -2690,17 +2690,15 @@ void Tabular::TeXTopHLine(otexstream & os, row_type 
row, list<col_type> const &
                                     && topltrims.find(c)->second)
                                        trim = "l";
                                col_type cstart = c;
-                               for ( ; c < ncols() - 1 && topline.find(c + 
1)->second ; ++c) {
+                               for ( ; c < ncols() - 1 && topline.find(c + 
1)->second
+                                     && (topltrims.find(c + 1) == 
topltrims.end()
+                                         || !topltrims.find(c + 1)->second
+                                         || isPartOfMultiColumn(row, c + 1)); 
++c) {
                                        if (isMultiColumn(cellIndex(row, c))
                                            && c < ncols() - 1 && 
isPartOfMultiColumn(row, c + 1))
                                                continue;
-                                       if (c > cstart && topltrims.find(c) != 
topltrims.end()
-                                                       && 
topltrims.find(c)->second) {
-                                               if (!isPartOfMultiColumn(row, 
c))
-                                                       --c;
-                                               break;
-                                       } else if (toprtrims.find(c) != 
toprtrims.end()
-                                                  && toprtrims.find(c)->second)
+                                       if (toprtrims.find(c) != toprtrims.end()
+                                           && toprtrims.find(c)->second)
                                                break;
                                }
 
@@ -2824,19 +2822,16 @@ void Tabular::TeXBottomHLine(otexstream & os, row_type 
row, list<col_type> const
                                     && bottomltrims.find(c)->second)
                                        trim = "l";
                                col_type cstart = c;
-                               for ( ; c < ncols() - 1 && bottomline.find(c + 
1)->second ; ++c) {
+                               for ( ; c < ncols() - 1 && bottomline.find(c + 
1)->second
+                                     && (bottomltrims.find(c + 1) == 
bottomltrims.end()
+                                         || !bottomltrims.find(c + 1)->second
+                                         || isPartOfMultiColumn(row, c + 1)); 
++c) {
                                        if (isMultiColumn(cellIndex(row, c))
                                            && c < ncols() - 1
                                            && isPartOfMultiColumn(row, c + 1))
                                                continue;
-                                       if (c > cstart
-                                           && bottomltrims.find(c) != 
bottomltrims.end()
-                                           && bottomltrims.find(c)->second) {
-                                               if (!isPartOfMultiColumn(row, 
c))
-                                                       --c;
-                                               break;
-                                       } else if (bottomrtrims.find(c) != 
bottomrtrims.end()
-                                                  && 
bottomrtrims.find(c)->second)
+                                       if (bottomrtrims.find(c) != 
bottomrtrims.end()
+                                           && bottomrtrims.find(c)->second)
                                                break;
                                }
 
diff --git a/status.24x b/status.24x
index 67b40fcb62..0a04996872 100644
--- a/status.24x
+++ b/status.24x
@@ -95,6 +95,8 @@ What's new
 
 - Fix handling of integrals with external computer algebra systems.
 
+- Fix cmidrule trimming in last column of a formal table (bug 13171).
+
 
 * USER INTERFACE
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to