Column insert: the per-row template keeps the formatting only

The template cloned the whole anchor cell, text included, once per covered
row. It is now an empty cell given the anchor's formatting. A test comment
described a default the command never had.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Zach Berry
2026-11-17 20:57:38 -06:00
co-authored by Claude Fable 5.2
parent 2fb8a04999
commit f65e481c95
2 changed files with 8 additions and 3 deletions
+6 -1
View File
@@ -390,7 +390,12 @@ fn insert_col_like(t: &mut Table, at: usize, neighbour: usize, keep_width: bool)
break;
}
}
t.rows[r].cells.get(n).cloned()
// Only the formatting is kept: the anchor's text is not copied once per covered row.
t.rows[r].cells.get(n).map(|src| {
let mut tpl = Cell::new("");
copy_cell_format(&mut tpl, src);
tpl
})
})
.collect();
if !t.insert_col(at) {
+2 -2
View File
@@ -7297,8 +7297,8 @@ fn master_body_placeholder_format_keeps_per_level_formatting() {
assert_eq!(shown(&s), vec![Some(28.0), Some(24.0)]);
}
/// A `keepWidth` that is not a bool is refused, naming it, and the table is left alone; it used
/// to be read as absent and the columns shrunk as if `true` had been asked.
/// A `keepWidth` that is not a bool is refused, naming it, and the table is left alone, not read
/// as the default (the table growing by the new column).
#[test]
fn table_insert_column_refuses_a_keep_width_that_is_not_a_bool() {
let mut s = session();