work
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 1 Dec 2025 16:56:18 +0000 (08:56 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 1 Dec 2025 16:56:18 +0000 (08:56 -0800)
rust/pspp/src/output/drivers/text.rs
rust/pspp/src/output/render.rs

index 65757b220f04163f54bb0c66e9fb728504737fd0..9b18ac44ad9f392b3cb2859903a131f837fb5c5b 100644 (file)
@@ -119,7 +119,10 @@ impl TextRenderer {
                 font_size: EnumMap::from_fn(|_| 1),
                 line_widths: EnumMap::from_fn(|stroke| if stroke == Stroke::None { 0 } else { 1 }),
                 px_size: None,
-                min_break: EnumMap::default(),
+                min_break: enum_map! {
+                    Axis2::X => width / 2,
+                    Axis2::Y => usize::MAX,
+                },
                 supports_margins: false,
                 rtl: false,
                 printing: true,
index a37618b83e49582ba2ef7c44ad58af70344eb2ae..9b4d71cc5799e65751f12e955298a083baa717dc 100644 (file)
@@ -669,13 +669,13 @@ impl Page {
 
     /// Creates and returns a new [Page] whose contents are a subregion of this
     /// page's contents.  The new page includes cells `extent` (exclusive) along
-    /// `axis`, plus any headers on `axis`.
+    /// axis `a`, plus any headers on `a`.
     ///
     /// If `pixel0` is nonzero, then it is a number of pixels to exclude from
-    /// the left or top (according to `axis`) of cell `extent.start`.
-    /// Similarly, `pixel1` is a number of pixels to exclude from the right or
-    /// bottom of cell `extent.end - 1`.  (`pixel0` and `pixel1` are used to
-    /// render cells that are too large to fit on a single page.)
+    /// the left or top (according to `a`) of cell `extent.start`.  Similarly,
+    /// `pixel1` is a number of pixels to exclude from the right or bottom of
+    /// cell `extent.end - 1`.  (`pixel0` and `pixel1` are used to render cells
+    /// that are too large to fit on a single page.)
     ///
     /// The whole of axis `!axis` is included.  (The caller may follow up with
     /// another call to select on `!axis`.)
@@ -756,6 +756,7 @@ impl Page {
             p0: pixel0,
             p1: pixel1,
         };
+        // Add overflows along the left side...
         if self.h[a] == 0 || z0 > self.h[a] || pixel0 > 0 {
             let mut z = 0;
             while z < self.n[b] {
@@ -783,13 +784,14 @@ impl Page {
             }
         }
 
+        // Add overflows along the right side.
         let mut z = 0;
         while z < self.n[b] {
             let d = Coord2::for_axis((a, z1 - 1), z);
             let cell = self.get_cell(d);
             if cell.rect[a].end > z1
                 || (cell.rect[a].end == z1 && pixel1 > 0)
-                    && overflows.contains_key(&s.coord_to_subpage(cell.rect.top_left()))
+                    && !overflows.contains_key(&s.coord_to_subpage(cell.rect.top_left()))
             {
                 let mut overflow = self.overflows.get(&d).cloned().unwrap_or_default();
                 overflow[a][1] +=