From xemacs-m  Wed Aug 20 22:24:48 1997
Received: from GS213.SP.CS.CMU.EDU (GS213.SP.CS.CMU.EDU [128.2.209.183])
	by xemacs.org (8.8.5/8.8.5) with SMTP id WAA24097
	for <xemacs-beta@xemacs.org>; Wed, 20 Aug 1997 22:24:48 -0500 (CDT)
Received: by GS213.SP.CS.CMU.EDU (AIX 3.2/UCB 5.64/4.03)
          id AA14675; Wed, 20 Aug 1997 23:24:49 -0400
Date: Wed, 20 Aug 1997 23:24:49 -0400
Message-Id: <9708210324.AA14675@GS213.SP.CS.CMU.EDU>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Darrell Kindred <dkindred@cmu.edu>
To: xemacs-beta@xemacs.org
Subject: [PATCH] 19.15p7 cursor glitch
Organization: Carnegie Mellon University School of Computer Science
X-Mailer: VM 6.22 under 19.15 XEmacs Lucid

I submitted the following patch shortly before 19.15 was
released.  A few dozen local users been running 19.15 with
this patch for the last few months, and the fix has been in
the 20.x source since 20.1, so I think it would be
reasonable to put it in 19.16.

Thanks,

Darrell

 From: Darrell Kindred <dkindred@cmu.edu>
 To: xemacs-beta@xemacs.org
 Subject: gdb-mode cursor bug [w/ patch]
 Date: Sun, 23 Mar 1997 00:48:47 -0500

I've noticed some cursor redisplay glitches that happen
on the line containing the gdb-mode "=>" arrow (a
"whitespace" glyph).  Instructions for reproducing:

    Eval this:
      (let ((b (generate-new-buffer "*test*")))
        (set-buffer b)
        (insert "      foo\n")
        (let ((e (make-extent (point-min) (point-min))))
          (set-extent-begin-glyph e (make-glyph "=>"))
          (set-extent-begin-glyph-layout e 'whitespace)
          (goto-char (point-min))
          (switch-to-buffer b)))

    Then, press M-u (uppercase-region).  The cursor at the
    beginning of the line isn't erased.  Now press C-l to
    fix that, then move to the second line, do
    reverse-isearch for "foo", and press C-a.  Cursor
    vanishes.

The patch below fixes both of these glitches.  It's not
critical, so it's probably best to just apply it to 20.1.

I've done some brief testing that suggested that the more
conservative test I inserted is rarely triggered during
typical editing operations, so the possibly-unnecessary
expense is probably not worth worrying about.

- Darrell

--- src/redisplay-output.c.orig	Sun Feb  2 00:07:27 1997
+++ src/redisplay-output.c	Sun Mar 23 00:43:08 1997
@@ -333,13 +333,23 @@
      full redraw of the block in order to make sure that the cursor is
      updated properly. */
   if (ddb->type != TEXT
+#if 0
+      /* I'm not sure exactly what this code wants to do, but it's
+       * not right--it doesn't update when cursor_elt changes from, e.g.,
+       * 0 to 8, and the new or old cursor loc overlaps this block.
+       * I've replaced it with the more conservative test below.
+       * -dkindred@cs.cmu.edu 23-Mar-1997 */
       && ((cdl->cursor_elt == -1 && ddl->cursor_elt != -1)
 	  || (cdl->cursor_elt != -1 && ddl->cursor_elt == -1))
       && (ddl->cursor_elt == -1 ||
 	  (cursor_start
 	   && cursor_width
 	   && (cursor_start + cursor_width) >= start_pixpos
-	   && cursor_start <= block_end)))
+	   && cursor_start <= block_end))
+#else
+      && (cdl->cursor_elt != ddl->cursor_elt)
+#endif
+      )
     force = 1;
 
   if (f->windows_structure_changed ||

