]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve copying current glyphs when building frame matrix
authorGerd Möllmann <gerd@gnu.org>
Tue, 21 Jan 2025 19:40:19 +0000 (20:40 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 23 Jan 2025 10:24:55 +0000 (11:24 +0100)
* src/dispnew.c (build_frame_matrix_from_leaf_window): Don't make space
glyphs. More comments.

(cherry picked from commit d30f40868bf260692c7702e43b439d592b830e16)

src/dispnew.c

index ff413fab574031d1872b98039f1d8b0219595d95..b65f0c1c62a00d73b9b418e2111e9899747d0105 100644 (file)
@@ -2624,22 +2624,27 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
          current_row_p = 1;
        }
 
+      /* If someone asks why we are copying current glyphs here, and
+        maybe never enable the desired frame row we copy to:
+
+        - there might be a window to the right of this one that has a
+          corresponding desired window row.
+        - we need the complete frame row for scrolling.  */
       if (current_row_p)
        {
-         /* 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.  */
+         /* If the desired glyphs for this row haven't been built, copy
+            from the corresponding current row. If that row is not
+            enabled, its contents might be invalid.  Make sure that
+            glyphs have valid frames set in that case.  This is closer
+            to what we did before child frames were added, and seems to
+            be something tty redisplay implicitly relies on.  */
          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;
-               }
+             to[i] = from[i];
+             if (!window_row->enabled_p)
+               to[i].frame = f;
            }
        }
       else