]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't copy non-enabled rows from child
authorGerd Möllmann <gerd@gnu.org>
Tue, 5 Nov 2024 09:25:22 +0000 (10:25 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 23 Dec 2024 14:54:02 +0000 (15:54 +0100)
* src/dispnew.c (copy_child_glyphs): Check if child row is enabled.

(cherry picked from commit 56708ea676e0fdfaeec36607333bb2955ec3b40e)

src/dispnew.c

index 0d7e7770bb001ddacbf29751426aa95e23070eb7..8de450b22f826457c4221d8d6ef64c2e946f217e 100644 (file)
@@ -102,6 +102,20 @@ static void adjust_frame_glyphs_for_window_redisplay (struct frame *);
 static void adjust_frame_glyphs_for_frame_redisplay (struct frame *);
 static void set_window_update_flags (struct window *w, bool on_p);
 
+#if 0 /* Please leave this in as a debugging aid.  */
+static void
+check_rows (struct frame *f)
+{
+  for (int y = 0; y < f->desired_matrix->nrows; ++y)
+    if (MATRIX_ROW_ENABLED_P (f->desired_matrix, y))
+      {
+       struct glyph_row *row = MATRIX_ROW (f->desired_matrix, y);
+       for (int x = 0; x < row->used[TEXT_AREA]; ++x)
+         eassert (row->glyphs[TEXT_AREA][x].frame != 0);
+      }
+}
+#endif
+
 /* True means last display completed.  False means it was preempted.  */
 
 bool display_completed;
@@ -3699,10 +3713,12 @@ copy_child_glyphs (struct frame *root, struct frame *child)
          neutralize_wide_char (root, root_row, r.x + r.w);
        }
 
-      /* Copy what's visible from the child's current row.  */
+      /* Copy what's visible from the child's current row.  If that row
+        is not enabled_p, we can't copy anything that makes sense.  */
       struct glyph_row *child_row = MATRIX_ROW (child->current_matrix, child_y);
-      memcpy (root_row->glyphs[0] + r.x, child_row->glyphs[0] + child_x,
-             r.w * sizeof (struct glyph));
+      if (child_row->enabled_p)
+       memcpy (root_row->glyphs[0] + r.x, child_row->glyphs[0] + child_x,
+               r.w * sizeof (struct glyph));
 
       /* Compute a new hash since we changed glyphs.  */
       root_row->hash = row_hash (root_row);