unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: wavexx@thregr.org
Cc: 12403-done@debbugs.gnu.org
Subject: bug#12403: 24.2; scroll-margin breaks emacs24
Date: Wed, 12 Sep 2012 20:15:03 +0300	[thread overview]
Message-ID: <83bohbw4bs.fsf@gnu.org> (raw)
In-Reply-To: <83har5ltma.fsf@gnu.org>

> Date: Mon, 10 Sep 2012 19:39:41 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 12403@debbugs.gnu.org
> 
> > Try with the following (under a graphical session):
> > 
> > emacs -q
> > 
> > open the tutorial, scroll with the arrow keys until you reach the bottom.
> > Everything looks ok.
> > 
> > kill emacs. Start again, this time:
> > 
> > C-x set-variable scroll-margin 5
> > 
> > open the tutorial, scroll down with the arrow keys until you reach the
> > bottom.  Text on the page looks *badly* garbled (this is not just
> > character left-overs from the previous screenfull, a lot of lines look
> > repeated at some point in the same line).
> 
> Confirmed :-(.  However, this bug was present even in the first
> pretest of Emacs 24, 24.0.90.
> 
> I will take a look.

Fixed in revision 108138 on the emacs-24 branch, with the following
patch:

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2012-09-12 14:59:56 +0000
+++ src/ChangeLog	2012-09-12 17:10:02 +0000
@@ -1,3 +1,11 @@
+2012-09-12  Eli Zaretskii  <eliz@gnu.org>
+
+	* xdisp.c (try_window_reusing_current_matrix): Under bidi
+	reordering, locate the cursor by calling set_cursor_from_row; if
+	that fails, clear the desired glyph matrix before returning a
+	failure indication to the caller.  Fixes leaving garbled display
+	when fast scrolling with a down-key.  (Bug#12403)
+
 2012-09-12  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* gtkutil.c (x_wm_set_size_hint): Use 1 col for base_width so it

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2012-05-30 18:09:17 +0000
+++ src/xdisp.c	2012-09-12 16:58:45 +0000
@@ -16593,28 +16593,33 @@ try_window_reusing_current_matrix (struc
 	    }
 	  if (row < bottom_row)
 	    {
-	      struct glyph *glyph = row->glyphs[TEXT_AREA] + w->cursor.hpos;
-	      struct glyph *end = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
-
-	      /* Can't use this optimization with bidi-reordered glyph
-		 rows, unless cursor is already at point. */
+	      /* Can't simply scan the row for point with
+		 bidi-reordered glyph rows.  Let set_cursor_from_row
+		 figure out where to put the cursor, and if it fails,
+		 give up.  */
 	      if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
 		{
-		  if (!(w->cursor.hpos >= 0
-			&& w->cursor.hpos < row->used[TEXT_AREA]
-			&& BUFFERP (glyph->object)
-			&& glyph->charpos == PT))
-		    return 0;
+		  if (!set_cursor_from_row (w, row, w->current_matrix,
+					    0, 0, 0, 0))
+		    {
+		      clear_glyph_matrix (w->desired_matrix);
+		      return 0;
+		    }
 		}
 	      else
-		for (; glyph < end
-		       && (!BUFFERP (glyph->object)
-			   || glyph->charpos < PT);
-		     glyph++)
-		  {
-		    w->cursor.hpos++;
-		    w->cursor.x += glyph->pixel_width;
-		  }
+		{
+		  struct glyph *glyph = row->glyphs[TEXT_AREA] + w->cursor.hpos;
+		  struct glyph *end = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
+
+		  for (; glyph < end
+			 && (!BUFFERP (glyph->object)
+			     || glyph->charpos < PT);
+		       glyph++)
+		    {
+		      w->cursor.hpos++;
+		      w->cursor.x += glyph->pixel_width;
+		    }
+		}
 	    }
 	}
 







      reply	other threads:[~2012-09-12 17:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10 14:50 bug#12403: 24.2; scroll-margin breaks emacs24 Yuri D'Elia
2012-09-10 16:39 ` Eli Zaretskii
2012-09-12 17:15   ` Eli Zaretskii [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83bohbw4bs.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=12403-done@debbugs.gnu.org \
    --cc=wavexx@thregr.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).