]> git.eshelyaron.com Git - emacs.git/commitdiff
Another case of copying from non-enabled glyphs (bug#74274)
authorGerd Möllmann <gerd@gnu.org>
Sun, 10 Nov 2024 15:18:29 +0000 (16:18 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 23 Dec 2024 14:54:22 +0000 (15:54 +0100)
* src/dispnew.c (build_frame_matrix_from_leaf_window): If current window
row is not enabled, don't copy from it.

(cherry picked from commit 582ebedd33ed957b9ad409e35ed7ba9dafa42c01)

src/dispnew.c

index 5ac8b7a6a71d39733d4a9314341115c5c7068b52..62339604f4e2050b5a3b7c594f5f6b86b01dd4a6 100644 (file)
@@ -2633,10 +2633,21 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
 
       if (current_row_p)
        {
-         /* Copy window row to frame row.  */
-         memcpy (frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
-                 window_row->glyphs[0],
-                 window_matrix->matrix_w * sizeof (struct glyph));
+         /* If the desired glyphs for this row haven't been built,
+            copy from the corresponding current row, but only if it
+            is enabled, because ottherwise its contents are invalid.  */
+         struct glyph *to = frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x;
+         struct glyph *from = window_row->glyphs[0];
+         for (int i = 0; i < window_matrix->matrix_w; ++i)
+           {
+             if (window_row->enabled_p)
+               to[i] = from[i];
+             else
+               {
+                 to[i] = space_glyph;
+                 to[i].frame = f;
+               }
+           }
        }
       else
        {