bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#29233: Enable fringe cursor when *almost* exact_window_width_line_p


From: Keith David Bershatsky
Subject: bug#29233: Enable fringe cursor when *almost* exact_window_width_line_p
Date: Thu, 09 Nov 2017 10:50:41 -0800

For those users who wish to customize the frame width pixelwise to a size such 
that exact_window_width_line_p will _never_ be true, those users miss out on 
the joy of seeing the fringe cursor bitmap.  While the patch that was applied 
pursuant to Bug#16856 fixed the problem with the cursor being drawn on top of 
the fringe (e5015c5d9632a0bf685c093249ae4a7d3e825b13), it does not permit a 
fringe bitmap to be placed there instead.

If I had it to do all over again, I would have made the following two 
modifications.  [I have not yet experimented with xterm.c and w32term.c to see 
if the new condition should be added there as well for Emacs platform builds on 
Windows and X11.]

In window.c, add the following condition to get_phys_cursor_glyph:

/* This modification enables placement of the cursor-in-fringe bitmap when
the window-width is slightly less than `glyph_row->exact_window_width_line_p`.
This modification also prevents drawing the real cursor on the fringe (instead
of using the cursor-in-fringe bitmap) in the above-mentioned circumstance. */

  struct frame *f = XFRAME (w->frame);
  int frame_char_width = FRAME_COLUMN_WIDTH (f);
  int text_area_width = window_box_width (w, TEXT_AREA);
  bool cursor_in_fringe_p = w->phys_cursor.x + frame_char_width >= 
text_area_width;
  if (cursor_in_fringe_p)
    return NULL;


And, in nsterm.m, modify a section of ns_draw_window_cursor to include the new 
condition:

  if ((phys_cursor_glyph = get_phys_cursor_glyph (w)) == NULL)
    {
      /* This modification enables placement of the cursor-in-fringe bitmap when
      the window-width is slightly less than 
`glyph_row->exact_window_width_line_p`.
      This modification also prevents drawing the real cursor on the fringe 
(instead
      of using the cursor-in-fringe bitmap) in the above-mentioned 
circumstance. */
      int frame_char_width = FRAME_COLUMN_WIDTH (f);
      int text_area_width = window_box_width (w, TEXT_AREA);
      bool cursor_in_fringe_p = w->phys_cursor.x + frame_char_width >= 
text_area_width;
      if ((glyph_row->exact_window_width_line_p
            && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])
          || cursor_in_fringe_p)
        {
          glyph_row->cursor_in_fringe_p = 1;
          draw_fringe_bitmap (w, glyph_row, 0);
        }
      return;
    }





reply via email to

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