emacs-devel
[Top][All Lists]
Advanced

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

Re: cursor-type as bar


From: Markus Gritsch
Subject: Re: cursor-type as bar
Date: Sun, 12 Mar 2006 10:45:20 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511

Juri Linkov wrote:
I would like to use a bar cursor, instead of a block cursor.
(setq default-frame-alist '((cursor-type . (bar . 2))))

I use the same cursor type and have the same problem.

The problem is, that the bar cursor is drawn like a block cursor, only
using a smaller width.

Actually, the way currently the bar cursor is drawn is worse than drawing
the block cursor.  The block cursor inverts the colors of the underlying
character, but the bar cursor partially or completely overlaps it.

To really be usable, the bar cursor should be drawn *between* the
characters, e.g. shifting it width/2 pixels to the left.

I agree this would be much better, but what to do if the distance between
the characters in pixels is less than the width of the bar cursor?
It seems overlapping is unavoidable.

Yes, I agree. Even when shifting the cursor so that it is located between the characters there will be some overlaping in certain cases. However, I would not invert the colors of the underlying character.

I tried to find the location where the cursor is drawn, and made the following experimental change, where the cursor is shifted by a hardcoded value of 1 to the left.

--- w32term_orig.c      2006-03-12 10:17:44.019393600 +0100
+++ w32term.c   2006-03-09 20:20:07.546683200 +0100
@@ -5021,7 +5021,7 @@

       if (kind == BAR_CURSOR)
        {
-         w32_fill_area (f, hdc, cursor_color, x,
+         w32_fill_area (f, hdc, cursor_color, x - 1,
                         WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
                         width, row->height);
        }

The problem is, that when moving the cursor, both caracters, left and right of the caret must be repainted. Currently only the character where the cursor was before moving it gets updated. The result can be seen in the attachment. Unfortunately I was not able to find out, how to redraw also the character before the one which gets already repainted.

Kind regards,
Markus

PNG image


reply via email to

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