]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug in "macintization" of x_draw_glyph_string
authorPo Lu <luangruo@yahoo.com>
Wed, 5 Oct 2022 00:31:44 +0000 (08:31 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 5 Oct 2022 00:32:00 +0000 (08:32 +0800)
* src/nsterm.m (ns_draw_stretch_glyph_string): Restore text decoration
drawing code ommitted during "macintization" to convert the X function
into NS code.  Reported by Qiantan Hong <qthong@stanford.edu>.

src/nsterm.m

index b68a6f8ec122655b38601ff9d44d373f9aed2948..82fe58e90ec36223532b9e97f58dd9bc7bb17ec1 100644 (file)
@@ -3995,6 +3995,7 @@ static void
 ns_draw_stretch_glyph_string (struct glyph_string *s)
 {
   struct face *face;
+  NSColor *fg_color;
 
   if (s->hl == DRAW_CURSOR
       && !x_stretch_cursor_p)
@@ -4091,8 +4092,20 @@ ns_draw_stretch_glyph_string (struct glyph_string *s)
          NSRectFill (NSMakeRect (x, s->y, background_width, s->height));
        }
     }
-}
 
+  /* Draw overlining, etc. on the stretch glyph (or the part of the
+     stretch glyph after the cursor).  If the glyph has a box, then
+     decorations will be drawn after drawing the box in
+     ns_draw_glyph_string, in order to prevent them from being
+     overwritten by the box.  */
+  if (s->face->box == FACE_NO_BOX)
+    {
+      fg_color = [NSColor colorWithUnsignedLong:
+                           NS_FACE_FOREGROUND (s->face)];
+      ns_draw_text_decoration (s, s->face, fg_color,
+                              s->background_width, s->x);
+    }
+}
 
 static void
 ns_draw_glyph_string_foreground (struct glyph_string *s)
@@ -4410,7 +4423,8 @@ ns_draw_glyph_string (struct glyph_string *s)
     {
       NSColor *fg_color;
 
-      fg_color = [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (s->face)];
+      fg_color = [NSColor colorWithUnsignedLong: NS_FACE_FOREGROUND (s->face)];
+
       ns_draw_text_decoration (s, s->face, fg_color,
                               s->background_width, s->x);
     }