emacs-devel
[Top][All Lists]
Advanced

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

Patch to fix the Bar Cursor Too Narrow problem on Mac OS X


From: Ben Key
Subject: Patch to fix the Bar Cursor Too Narrow problem on Mac OS X
Date: Thu, 17 Feb 2011 22:29:35 -0600

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.


reply via email to

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