bug#3005: 23.0.92; w32term.c: width of hbar cursor on a wide character

Yu-ji Hosokawa <[email protected]>
Newsgroups gmane.emacs.bugs,gmane.emacs.pretest.bugs
Message-ID <[email protected]>
Hello,

>> From: Yu-ji Hosokawa Sent: Wednesday, April 15, 2009 5:03 PM
>> The width of HBAR cursor on a wide character is narrower than the
>> character width.
>> On Emacs 22.3, HBAR cursor width and the underlying character width
>> were the same. It is a desirable view, I think.
> 
> See bug #1258.

Thank you for the info.
Again patch. How about the following?
It works fine for me. but I noticed that even if it patched, still
not relieve composed form character width.

thanks,
--yu



$ cvs diff -pu src/w32term.c
Index: src/w32term.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32term.c,v
retrieving revision 1.323
diff -p -u -r1.323 w32term.c
--- src/w32term.c       22 Mar 2009 02:39:30 -0000      1.323
+++ src/w32term.c       16 Apr 2009 21:38:49 -0000
@@ -4971,6 +4971,7 @@ x_draw_bar_cursor (w, row, width, kind)
   struct frame *f = XFRAME (w->frame);
   struct glyph *cursor_glyph;
   int x;
+  int hbar_width;
   HDC hdc;

   /* If cursor is out of bounds, don't draw garbage.  This can happen
@@ -5022,10 +5023,16 @@ x_draw_bar_cursor (w, row, width, kind)
        }
       else
        {
+         hbar_width = min (FRAME_COLUMN_WIDTH (f), cursor_glyph->pixel_width);
+
+         /* Multibyte character can be wider than FRAME_COLUMN_WIDTH. */
+         if (cursor_glyph->type == CHAR_GLYPH && cursor_glyph->u.ch >= 0x80)
+           hbar_width = cursor_glyph->pixel_width;
+
          w32_fill_area (f, hdc, cursor_color, x,
                         WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y +
                                                  row->height - width),
-                        min (FRAME_COLUMN_WIDTH (f), cursor_glyph->pixel_width),
+                        hbar_width,
                         width);
        }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.