summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--library/src/layout/table.rs4
-rw-r--r--tests/ref/bugs/table-lines.pngbin0 -> 1180 bytes
-rw-r--r--tests/typ/bugs/table-lines.typ10
3 files changed, 14 insertions, 0 deletions
diff --git a/library/src/layout/table.rs b/library/src/layout/table.rs
index 3235c790..357263f4 100644
--- a/library/src/layout/table.rs
+++ b/library/src/layout/table.rs
@@ -175,6 +175,10 @@ impl Layout for TableElem {
// Add lines and backgrounds.
for (frame, rows) in layout.fragment.iter_mut().zip(&layout.rows) {
+ if layout.cols.is_empty() || rows.is_empty() {
+ continue;
+ }
+
// Render table lines.
if let Some(stroke) = &stroke {
let thickness = stroke.thickness;
diff --git a/tests/ref/bugs/table-lines.png b/tests/ref/bugs/table-lines.png
new file mode 100644
index 00000000..600391cb
--- /dev/null
+++ b/tests/ref/bugs/table-lines.png
Binary files differ
diff --git a/tests/typ/bugs/table-lines.typ b/tests/typ/bugs/table-lines.typ
new file mode 100644
index 00000000..7e954012
--- /dev/null
+++ b/tests/typ/bugs/table-lines.typ
@@ -0,0 +1,10 @@
+// Ensure no empty lines before a table that doesn't fit into the first page.
+
+---
+#set page(height: 50pt)
+
+Hello
+#table(
+ columns: 4,
+ [1], [2], [3], [4]
+)