all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ben Key <bkey76@gmail.com>
To: Emacs-devel@gnu.org
Cc: david+emacsformacosx@porkrind.org
Subject: Patch to fix the Bar Cursor Too Narrow problem on Mac OS X
Date: Thu, 17 Feb 2011 22:29:35 -0600	[thread overview]
Message-ID: <AANLkTim=HY1nANJe5K3zsh=SJ=9a0W+enXwjCEXU-1wz@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2469 bytes --]

Hello,

The first thing I noticed when I began using Emacs on Mac OS X was that when
Emacs is configured to use a bar cursor the cursor is difficult to see
because it is too narrow, even when the width of the bar cursor is specified
by using the (bar . WIDTH) syntax when setting the value of the cursor-type
variable.  The following patch fixes this problem.

There are three changes in this patch.

   1. The function get_specified_cursor_type in src/xdisp.c has been
   modified so that the width output parameter is always initialized.
   2. FIXME comments that are no longer valid have been removed from
the function
   ns_draw_window_cursor in nsterm.m.  The comments are no longer valid because
   they discuss the cursor_width may not be initialized problem that is
   fixed by change 1.
   3. In the BAR_CURSOR case, s.size.width is set equal to "min
   (cursor_width, w->phys_cursor_width)."  Previously it was set equal to "min
   (cursor_width, 2)" which effectively caused the user specified value for the
   cursor width to be ignored.


<patch>
=== modified file 'src/nsterm.m'
--- src/nsterm.m    2011-02-17 10:19:29 +0000
+++ src/nsterm.m    2011-02-18 03:43:28 +0000
@@ -2232,9 +2232,6 @@
 /*
--------------------------------------------------------------------------
      External call (RIF): draw cursor
      (modeled after x_draw_window_cursor
-     FIXME: cursor_width is effectively bogus -- it sometimes gets set
-     in xdisp.c set_frame_cursor_types, sometimes left uninitialized;
-     DON'T USE IT (no other terms do)

--------------------------------------------------------------------------
*/
 {
   NSRect r, s;
@@ -2335,7 +2332,7 @@
       break;
     case BAR_CURSOR:
       s = r;
-      s.size.width = min (cursor_width, 2); //FIXME(see above)
+      s.size.width = min (cursor_width, w->phys_cursor_width);

       /* If the character under cursor is R2L, draw the bar cursor
          on the right of its glyph, rather than on the left.  */

=== modified file 'src/xdisp.c'
--- src/xdisp.c    2011-02-16 18:39:46 +0000
+++ src/xdisp.c    2011-02-18 03:45:19 +0000
@@ -23201,6 +23201,12 @@
 {
   enum text_cursor_kinds type;

+  /*
+  Initialize width to a reasonable default value here to ensure that there
can
+  never be a case in which the function exits without width being
initialized.
+  */
+  *width = 2;
+
   if (NILP (arg))
     return NO_CURSOR;


</patch>

I tested these changes against revision 103325 on Mac OS X.

[-- Attachment #2: Type: text/html, Size: 2985 bytes --]

             reply	other threads:[~2011-02-18  4:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-18  4:29 Ben Key [this message]
2011-02-19 19:15 ` Patch to fix the Bar Cursor Too Narrow problem on Mac OS X Chong Yidong
2011-02-20  1:23   ` Ben Key
2011-02-21 17:40     ` Chong Yidong
2011-02-21 17:58     ` Chong Yidong
2011-02-21 21:15       ` Ben Key
2011-02-21 22:56         ` Ben Key
2011-02-22  0:23         ` Chong Yidong
2011-02-22  0:35           ` Chong Yidong
2011-02-22 13:09             ` Adrian Robert
2011-02-23 20:06               ` Chong Yidong
2011-02-24 12:38                 ` Jan Djärv
2011-02-23 20:45         ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTim=HY1nANJe5K3zsh=SJ=9a0W+enXwjCEXU-1wz@mail.gmail.com' \
    --to=bkey76@gmail.com \
    --cc=Emacs-devel@gnu.org \
    --cc=david+emacsformacosx@porkrind.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.