emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r101079: Fix cursor drawing on stretc


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101079: Fix cursor drawing on stretch glyphs in R2L lines.
Date: Sat, 14 Aug 2010 15:55:04 +0300
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101079
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2010-08-14 15:55:04 +0300
message:
  Fix cursor drawing on stretch glyphs in R2L lines.
  
   xterm.c (x_draw_stretch_glyph_string):
   w32term.c (x_draw_stretch_glyph_string): In R2L rows, display the
   cursor on the right edge of the stretch glyph.
   xdisp.c (window_box_right_offset, window_box_right): Fix commentary.
modified:
  src/ChangeLog
  src/w32term.c
  src/xdisp.c
  src/xterm.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-08-14 10:59:55 +0000
+++ b/src/ChangeLog     2010-08-14 12:55:04 +0000
@@ -1,5 +1,12 @@
 2010-08-14  Eli Zaretskii  <address@hidden>
 
+       * xterm.c (x_draw_stretch_glyph_string):
+       * w32term.c (x_draw_stretch_glyph_string): In R2L rows, display
+       the cursor on the right edge of the stretch glyph.
+
+       * xdisp.c (window_box_right_offset, window_box_right): Fix
+       commentary.
+
        * xdisp.c (Fcurrent_bidi_paragraph_direction): Fix paragraph
        direction when point is inside a run of whitespace characters.
 

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2010-07-25 00:20:51 +0000
+++ b/src/w32term.c     2010-08-14 12:55:04 +0000
@@ -2106,17 +2106,34 @@
   if (s->hl == DRAW_CURSOR
       && !x_stretch_cursor_p)
     {
-      /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
-        as wide as the stretch glyph.  */
+      /* If `x-stretch-cursor' is nil, don't draw a block cursor as
+        wide as the stretch glyph.  */
       int width, background_width = s->background_width;
-      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
-
-      if (x < left_x)
-       {
-         background_width -= left_x - x;
-         x = left_x;
+      int x = s->x;
+
+      if (!s->row->reversed_p)
+       {
+         int left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+         if (x < left_x)
+           {
+             background_width -= left_x - x;
+             x = left_x;
+           }
+       }
+      else
+       {
+         /* In R2L rows, draw the cursor on the right edge of the
+            stretch glyph.  */
+         int right_x = window_box_right_offset (s->w, TEXT_AREA);
+
+         if (x + background_width > right_x)
+           background_width -= x - right_x;
+         x += background_width;
        }
       width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
+      if (s->row->reversed_p)
+       x -= width;
 
       /* Draw cursor.  */
       x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
@@ -2130,7 +2147,10 @@
          RECT r;
           HDC hdc = s->hdc;
 
-         x += width;
+         if (!s->row->reversed_p)
+           x += width;
+         else
+           x = s->x;
          if (s->row->mouse_face_p
              && cursor_in_mouse_face_p (s->w))
            {

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2010-08-14 10:59:55 +0000
+++ b/src/xdisp.c       2010-08-14 12:55:04 +0000
@@ -1208,7 +1208,7 @@
 
 
 /* Return the window-relative coordinate of the right edge of display
-   area AREA of window W.  AREA < 0 means return the left edge of the
+   area AREA of window W.  AREA < 0 means return the right edge of the
    whole window, to the left of the right fringe of W.  */
 
 INLINE int
@@ -1238,7 +1238,7 @@
 
 
 /* Return the frame-relative coordinate of the right edge of display
-   area AREA of window W.  AREA < 0 means return the left edge of the
+   area AREA of window W.  AREA < 0 means return the right edge of the
    whole window, to the left of the right fringe of W.  */
 
 INLINE int

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2010-08-11 12:34:46 +0000
+++ b/src/xterm.c       2010-08-14 12:55:04 +0000
@@ -2435,17 +2435,34 @@
   if (s->hl == DRAW_CURSOR
       && !x_stretch_cursor_p)
     {
-      /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
-        as wide as the stretch glyph.  */
+      /* If `x-stretch-cursor' is nil, don't draw a block cursor as
+        wide as the stretch glyph.  */
       int width, background_width = s->background_width;
-      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
-
-      if (x < left_x)
-       {
-         background_width -= left_x - x;
-         x = left_x;
+      int x = s->x;
+
+      if (!s->row->reversed_p)
+       {
+         int left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+         if (x < left_x)
+           {
+             background_width -= left_x - x;
+             x = left_x;
+           }
+       }
+      else
+       {
+         /* In R2L rows, draw the cursor on the right edge of the
+            stretch glyph.  */
+         int right_x = window_box_right_offset (s->w, TEXT_AREA);
+
+         if (x + background_width > right_x)
+           background_width -= x - right_x;
+         x += background_width;
        }
       width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
+      if (s->row->reversed_p)
+       x -= width;
 
       /* Draw cursor.  */
       x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
@@ -2458,7 +2475,10 @@
          XRectangle r;
          GC gc;
 
-         x += width;
+         if (!s->row->reversed_p)
+           x += width;
+         else
+           x = s->x;
          if (s->row->mouse_face_p
              && cursor_in_mouse_face_p (s->w))
            {


reply via email to

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