emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch for Mac OS X Text Drawing


From: YAMAMOTO Mitsuharu
Subject: Re: Patch for Mac OS X Text Drawing
Date: Mon, 24 Jan 2005 18:36:42 +0900
User-agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Fri, 21 Jan 2005 16:57:51 +0900, YAMAMOTO Mitsuharu <address@hidden> 
>>>>> said:

> Could someone check if the following change makes sense?

It turned out that the posted patch was closely related to the
following problem (also on X11), which I've reported to
emacs-pretest-bug:

>>>>> On Fri, 21 Jan 2005 12:53:37 +0900 (JST), YAMAMOTO Mitsuharu 
>>>>> <address@hidden> said:

> I noticed that the cursor remained unerased with the following
> procedure:

> 1. % emacs -Q -fn -adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1 & 
> 2. Type "RET C-p W C-b W W W W ...."

> This happens with any cursor type.

Here is a revised patch including a fix for the above bug.

                                      YAMAMOTO Mituharu
                                address@hidden

Index: src/dispextern.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/dispextern.h,v
retrieving revision 1.192
diff -c -r1.192 dispextern.h
*** src/dispextern.h    10 Jan 2005 13:30:46 -0000      1.192
--- src/dispextern.h    24 Jan 2005 08:42:45 -0000
***************
*** 1193,1198 ****
--- 1193,1203 ----
    /* Slice */
    struct glyph_slice slice;
  
+   /* Non-null means the horizontal clipping region starts from the
+      left edge of *clip_head, and ends with the right edge of
+      *clip_tail, not including their overhangs.  */
+   struct glyph_string *clip_head, *clip_tail;
+ 
    struct glyph_string *next, *prev;
  };
  
Index: src/xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.969
diff -c -r1.969 xdisp.c
*** src/xdisp.c 23 Jan 2005 00:50:52 -0000      1.969
--- src/xdisp.c 24 Jan 2005 08:42:47 -0000
***************
*** 1786,1791 ****
--- 1786,1809 ----
        r.height = s->row->visible_height;
      }
  
+   if (s->clip_head)
+     if (r.x < s->clip_head->x)
+       {
+       if (r.width >= s->clip_head->x - r.x)
+         r.width -= s->clip_head->x - r.x;
+       else
+         r.width = 0;
+       r.x = s->clip_head->x;
+       }
+   if (s->clip_tail)
+     if (r.x + r.width > s->clip_tail->x + s->clip_tail->background_width)
+       {
+       if (s->clip_tail->x + s->clip_tail->background_width >= r.x)
+         r.width = s->clip_tail->x + s->clip_tail->background_width - r.x;
+       else
+         r.width = 0;
+       }
+ 
    /* If S draws overlapping rows, it's sufficient to use the top and
       bottom of the window for clipping because this glyph string
       intentionally draws over other lines.  */
***************
*** 18231,18236 ****
--- 18249,18255 ----
  {
    struct glyph_string *head, *tail;
    struct glyph_string *s;
+   struct glyph_string *clip_head = NULL, *clip_tail = NULL;
    int last_x, area_width;
    int x_reached;
    int i, j;
***************
*** 18299,18304 ****
--- 18318,18324 ----
          start = i;
          compute_overhangs_and_x (t, head->x, 1);
          prepend_glyph_string_lists (&head, &tail, h, t);
+         clip_head = head;
        }
  
        /* Prepend glyph strings for glyphs in front of the first glyph
***************
*** 18311,18316 ****
--- 18331,18337 ----
        i = left_overwriting (head);
        if (i >= 0)
        {
+         clip_head = head;
          BUILD_GLYPH_STRINGS (i, start, h, t,
                               DRAW_NORMAL_TEXT, dummy_x, last_x);
          for (s = h; s; s = s->next)
***************
*** 18330,18335 ****
--- 18351,18357 ----
                               DRAW_NORMAL_TEXT, x, last_x);
          compute_overhangs_and_x (h, tail->x + tail->width, 0);
          append_glyph_string_lists (&head, &tail, h, t);
+         clip_tail = tail;
        }
  
        /* Append glyph strings for glyphs following the last glyph
***************
*** 18340,18345 ****
--- 18362,18368 ----
        i = right_overwriting (tail);
        if (i >= 0)
        {
+         clip_tail = tail;
          BUILD_GLYPH_STRINGS (end, i, h, t,
                               DRAW_NORMAL_TEXT, x, last_x);
          for (s = h; s; s = s->next)
***************
*** 18347,18352 ****
--- 18370,18381 ----
          compute_overhangs_and_x (h, tail->x + tail->width, 0);
          append_glyph_string_lists (&head, &tail, h, t);
        }
+       if (clip_head || clip_tail)
+       for (s = head; s; s = s->next)
+         {
+           s->clip_head = clip_head;
+           s->clip_tail = clip_tail;
+         }
      }
  
    /* Draw all strings.  */
***************
*** 18360,18367 ****
         completely. */
        && !overlaps_p)
      {
!       int x0 = head ? head->x : x;
!       int x1 = tail ? tail->x + tail->background_width : x;
  
        int text_left = window_box_left (w, TEXT_AREA);
        x0 -= text_left;
--- 18389,18397 ----
         completely. */
        && !overlaps_p)
      {
!       int x0 = clip_head ? clip_head->x : (head ? head->x : x);
!       int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width
!               : (tail ? tail->x + tail->background_width : x));
  
        int text_left = window_box_left (w, TEXT_AREA);
        x0 -= text_left;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]