emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 r117505: Fix display of hollow-box and hbar curso


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 r117505: Fix display of hollow-box and hbar cursors on r2L lines.
Date: Tue, 16 Sep 2014 15:54:21 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117505
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Tue 2014-09-16 18:53:36 +0300
message:
  Fix display of hollow-box and hbar cursors on r2L lines.
  
   src/xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor):
   src/w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor): In R2L
   lines, draw the hollow-box and hbar cursors on the right side of
   cursor-glyph.  Thanks to martin rudalics <address@hidden> for
   testing on X.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/w32term.c                  w32term.c-20091113204419-o5vbwnq5f7feedwu-950
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-16 15:44:51 +0000
+++ b/src/ChangeLog     2014-09-16 15:53:36 +0000
@@ -1,5 +1,11 @@
 2014-09-16  Eli Zaretskii  <address@hidden>
 
+       * xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor):
+       * w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor): In R2L
+       lines, draw the hollow-box and hbar cursors on the right side of
+       cursor-glyph.  Thanks to martin rudalics <address@hidden> for
+       testing on X.
+
        * xterm.c (x_draw_stretch_glyph_string):
        * w32term.c (x_draw_stretch_glyph_string): Fix a thinko that
        caused the block cursor to disappear on a TAB in R2L lines in

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2014-09-16 15:44:51 +0000
+++ b/src/w32term.c     2014-09-16 15:53:36 +0000
@@ -5086,6 +5086,12 @@
   /* Compute frame-relative coordinates for phys cursor.  */
   get_phys_cursor_geometry (w, row, cursor_glyph, &left, &top, &h);
   rect.left = left;
+  /* When on R2L character, show cursor at the right edge of the
+     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)
+    rect.left += cursor_glyph->pixel_width - w->phys_cursor_width;
   rect.top = top;
   rect.bottom = rect.top + h;
   rect.right = rect.left + w->phys_cursor_width;
@@ -5167,7 +5173,7 @@
                         WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
                         width, row->height);
        }
-      else
+      else     /* HBAR_CURSOR */
        {
          int dummy_x, dummy_y, dummy_h;
 
@@ -5178,6 +5184,9 @@
 
          get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x,
                                    &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;
          w32_fill_area (f, hdc, cursor_color, x,
                         WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y +
                                                  row->height - width),

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2014-09-16 15:44:51 +0000
+++ b/src/xterm.c       2014-09-16 15:53:36 +0000
@@ -7126,6 +7126,15 @@
                                            GCForeground, &xgcv);
   gc = dpyinfo->scratch_cursor_gc;
 
+  /* When on R2L character, show cursor at the right edge of the
+     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)
+    {
+      x += cursor_glyph->pixel_width - w->phys_cursor_width;
+      wd -= 1;
+    }
   /* Set clipping, draw the rectangle, and reset clipping again.  */
   x_clip_to_row (w, row, TEXT_AREA, gc);
   XDrawRectangle (dpy, FRAME_X_WINDOW (f), gc, x, y, wd, h - 1);
@@ -7211,9 +7220,10 @@
                          WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
                          width, row->height);
        }
-      else
+      else /* HBAR_CURSOR */
        {
          int dummy_x, dummy_y, dummy_h;
+         int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
 
          if (width < 0)
            width = row->height;
@@ -7223,8 +7233,10 @@
          get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x,
                                    &dummy_y, &dummy_h);
 
-         XFillRectangle (dpy, window, gc,
-                         WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
+         if ((cursor_glyph->resolved_level & 1) != 0
+             && cursor_glyph->pixel_width > w->phys_cursor_width)
+           x += cursor_glyph->pixel_width - w->phys_cursor_width;
+         XFillRectangle (dpy, window, gc, x,
                          WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y +
                                                   row->height - width),
                          w->phys_cursor_width, width);


reply via email to

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