]> git.eshelyaron.com Git - emacs.git/commitdiff
A better fix for drawing hollow cursor on X on 1-pixel thin space characters.
authorEli Zaretskii <eliz@gnu.org>
Sat, 18 Oct 2014 13:09:18 +0000 (16:09 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 18 Oct 2014 13:09:18 +0000 (16:09 +0300)
 src/xterm.c (x_draw_bar_cursor, x_draw_hollow_cursor): Subtract 1
 pixel from the window's cursor glyph width, since X renders hollow
 blocks 1 pixel wider than the 'width' parameter.
 src/xdisp.c (get_phys_cursor_geometry): Don't subtract 1 pixel from
 glyph->pixel_width; this is now done in xterm.c.

src/ChangeLog
src/xdisp.c
src/xterm.c

index 66306bd5fb6c95555e0d7bb7e2847cabc53bd437..a28ae469001b890ffd2fd3d7f2d9c642b4f8bbb6 100644 (file)
@@ -1,5 +1,12 @@
 2014-10-18  Eli Zaretskii  <eliz@gnu.org>
 
+       * xterm.c (x_draw_bar_cursor, x_draw_hollow_cursor): Subtract 1
+       pixel from the window's cursor glyph width, since X renders hollow
+       blocks 1 pixel wider than the 'width' parameter.
+
+       * xdisp.c (get_phys_cursor_geometry): Don't subtract 1 pixel from
+       glyph->pixel_width; this is now done in xterm.c.
+
        Fix reordering of bracket characters in isolates.
        * bidi.c (bidi_cache_find): Rename the argument NEUTRALS_OK to
        RESOLVED_ONLY; when non-zero, return from the cache only fully
index 7c3aaa2042e6a4b8ce01e0887a499ce1e4dcfa49..ad28dacf4e55d56b41f5f9a5a99bf1328b573a8f 100644 (file)
@@ -2302,10 +2302,7 @@ get_phys_cursor_geometry (struct window *w, struct glyph_row *row,
      glyph, and `x-stretch-block-cursor' is nil, don't draw a
      rectangle as wide as the glyph, but use a canonical character
      width instead.  */
-  wd = glyph->pixel_width - 1;
-#if defined (HAVE_NTGUI) || defined (HAVE_NS)
-  wd++; /* Why? */
-#endif
+  wd = glyph->pixel_width;
 
   x = w->phys_cursor.x;
   if (x < 0)
index 334eafcd3feb5a3134473aa755e6bd11d20fe1f4..a1e338b54ee342a4186501e0e368392d3f8380e6 100644 (file)
@@ -7965,7 +7965,7 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
 
   /* Compute frame-relative coordinates for phys cursor.  */
   get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h);
-  wd = w->phys_cursor_width;
+  wd = w->phys_cursor_width - 1;
 
   /* The foreground of cursor_gc is typically the same as the normal
      background color, which can cause the cursor box to be invisible.  */
@@ -7981,9 +7981,9 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
      glyph, unless the cursor box is as wide as the glyph or wider
      (the latter happens when x-stretch-cursor is non-nil).  */
   if ((cursor_glyph->resolved_level & 1) != 0
-      && cursor_glyph->pixel_width > w->phys_cursor_width)
+      && cursor_glyph->pixel_width > wd)
     {
-      x += cursor_glyph->pixel_width - w->phys_cursor_width;
+      x += cursor_glyph->pixel_width - wd;
       if (wd > 0)
        wd -= 1;
     }
@@ -8086,12 +8086,12 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
                                    &dummy_y, &dummy_h);
 
          if ((cursor_glyph->resolved_level & 1) != 0
-             && cursor_glyph->pixel_width > w->phys_cursor_width)
-           x += cursor_glyph->pixel_width - w->phys_cursor_width;
+             && cursor_glyph->pixel_width > w->phys_cursor_width - 1)
+           x += cursor_glyph->pixel_width - w->phys_cursor_width + 1;
          XFillRectangle (dpy, window, gc, x,
                          WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y +
                                                   row->height - width),
-                         w->phys_cursor_width, width);
+                         w->phys_cursor_width - 1, width);
        }
 
       XSetClipMask (dpy, gc, None);