From xemacs-m  Sun Mar 23 02:31:00 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 CAA04543
	for <xemacs-beta@xemacs.org>; Sun, 23 Mar 1997 02:31:00 -0600 (CST)
Received: by GS213.SP.CS.CMU.EDU (AIX 3.2/UCB 5.64/4.03)
          id AA14878; Sun, 23 Mar 1997 03:30:57 -0500
Date: Sun, 23 Mar 1997 03:30:57 -0500
Message-Id: <9703230830.AA14878@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: one more cursor patch
Organization: Carnegie Mellon University School of Computer Science
In-Reply-To: <m23etnm79b.fsf@altair.xemacs.org>
References: <9703230320.AA07324@GS213.SP.CS.CMU.EDU>
	<m2vi6jm9jq.fsf@altair.xemacs.org>
	<9703230603.AA31841@GS213.SP.CS.CMU.EDU>
	<m23etnm79b.fsf@altair.xemacs.org>
X-Mailer: VM 6.22 under 19.15 XEmacs Lucid (beta103)

The patch below fixes a cursor glitch Adrian Aichner,
Michael Harnois, and Steve pointed out a week or so ago.

To see the glitch, use w3 or something to get a large image
displayed, such that the image starts at the top of the
window and is clipped at the bottom.  Move the cursor to
the end of the line containing the image, and you'll get the
cursor drawn in the echo-area and/or over the modeline.

The patch below fixes this problem, and ensures that the
cursor is always visible in such cases.

I'm fairly confident in this patch, so if you want to apply
it to 19.15, that's okay with me.

- Darrell

--- src/redisplay-x.c.semi-orig	Sat Mar 22 20:18:50 1997
+++ src/redisplay-x.c	Sun Mar 23 03:10:34 1997
@@ -2077,12 +2077,10 @@
     default_face_font_info (window, &defascent, 0, &defheight, 0, 0);
   }
   
-  cursor_y = dl->ypos - defascent;
-  if (cursor_y < y)
-    cursor_y = y;
-  cursor_height = defheight;
-  if (cursor_y + cursor_height > y + height)
-    cursor_height = y + height - cursor_y;
+  /* make sure the cursor is entirely contained between y and y+height */
+  cursor_height = min (defheight, height);
+  cursor_y = max (y, min (y + height - cursor_height, 
+			  dl->ypos - defascent));
   
   if (focus)
     {

