[LyX/2.5.x] Consider longtable caption when adding new column (#13299)

Juergen Spitzmueller <[email protected]> Thu, 23 Apr 2026 16:40:37 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 963ae7eeb14417d2f4a52c5985364e03f4d4eefc
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Apr 10 06:37:38 2026 +0200

    Consider longtable caption when adding new column (#13299)
    
    (cherry picked from commit 9740b2904af4b3e57dde5826ddb78ad175ad8069)
---
 src/insets/InsetTabular.cpp | 10 +++++-----
 status.25x                  |  2 ++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index a4e8603338..df0b5e0430 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -1050,12 +1050,12 @@ void Tabular::insertColumn(col_type col, bool copy, row_type row)
 		cell_info[r].insert(cell_info[r].begin() + col + 1,
 			copy ? cell_info[r][col] : CellData(buffer_));
 		// make new cell part of multicolumn if old cell was at the beginning
-		// or middle of a multicolumn
+		// or middle of a multicolumn, or if it is part of a longtable caption
 		if (cell_info[r][col].multicolumn == CELL_BEGIN_OF_MULTICOLUMN
-			|| (col + 2 < ncols()
-				&& cell_info[r][col].multicolumn == CELL_PART_OF_MULTICOLUMN
-				&& cell_info[r][col + 2].multicolumn == CELL_PART_OF_MULTICOLUMN
-			))
+		    || (col + 2 < ncols()
+			&& cell_info[r][col].multicolumn == CELL_PART_OF_MULTICOLUMN
+			&& cell_info[r][col + 2].multicolumn == CELL_PART_OF_MULTICOLUMN)
+		    || (is_long_tabular && ltCaption(r)))
 			cell_info[r][col + 1].multicolumn = CELL_PART_OF_MULTICOLUMN;
 	}
 	updateIndexes();
diff --git a/status.25x b/status.25x
index 0176b9db82..a339e241e4 100644
--- a/status.25x
+++ b/status.25x
@@ -50,6 +50,8 @@ What's new
 
 * USER INTERFACE
 
+- Consider longtable caption when adding new column (bug 13299).
+
 - Load externally referred buffers and initialize their labels.
 
 - Fix pasting of cross-references in math (bug 13290).
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs