unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Eli Zaretskii <eliz@gnu.org>
Cc: alexanderm@web.de, 25792@debbugs.gnu.org
Subject: bug#25792: 26.0.50; Scroll-margin working incorrectly when scrolling down if show-trailing-whitespace is t
Date: Mon, 20 Feb 2017 12:42:58 -0500	[thread overview]
Message-ID: <87r32siwrh.fsf@users.sourceforge.net> (raw)
In-Reply-To: <83fuj9q4r4.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 19 Feb 2017 22:56:15 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Sun, 19 Feb 2017 19:20:40 +0200
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: alexanderm@web.de, 25792@debbugs.gnu.org
>> 
>> > From: npostavs@users.sourceforge.net
>> > Date: Sun, 19 Feb 2017 11:59:22 -0500
>> > Cc: 25792@debbugs.gnu.org
>> > 
>> > > Only scrolling down is affected. The issue first appeared when I
>> > > recompiled emacs roughly 1 week ago and has persisted over multiple
>> > > recompilations on 2 different laptops (both running Antergos & Xfce), so
>> > > my guess is that it's an issue in the current emacs master.
>> > 
>> > This seems to be caused by [1: b9be4c14e8], it only happens when the
>> > window has partial lines (i.e., (zerop (cadr (cl-floor
>> > (window-screen-lines)))) is non-nil).  Not sure how
>> > show-trailing-whitespace affects this, but it does.
>> 
>> My guess would be that show-trailing-whitespace causes an additional
>> redisplay cycle, due to its post-command-hook.
>
> If you invoke trace-redisplay and then run the recipe, you will see
> that there are two kinds of redisplay cycles: one that calls
> try_scrolling, the other that doesn't.  So there are 2 different paths
> through redisplay, and they don't behave the same under these
> conditions.

The difference seems to be that try_window returns -1 in the case where
we correctly stay out of the margin, but 1 in the case where we cross
into it.  I tried adding a partial_line_height call, but it's not giving
the right answer.  The move_it_to (&it, ZV, -1, it.last_visible_y, -1,
MOVE_TO_POS | MOVE_TO_Y) call doesn't stop at last_visible_y, it goes to
the end of buffer, so the returned partial height is a very large number
(approx 6500 in my test).

modified   src/xdisp.c
@@ -17389,9 +17389,10 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
 	  /* rms: considering make_cursor_line_fully_visible_p here
 	     seems to give wrong results.  We don't want to recenter
 	     when the last line is partly visible, we want to allow
 	     that case to be handled in the usual way.  */
-	  || w->cursor.y > it.last_visible_y - this_scroll_margin - 1)
+	  || w->cursor.y > (it.last_visible_y - partial_line_height (&it)
+                            - this_scroll_margin - 1))
 	{
 	  w->cursor.vpos = -1;
 	  clear_glyph_matrix (w->desired_matrix);
 	  return -1;





  reply	other threads:[~2017-02-20 17:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-19 15:34 bug#25792: 26.0.50; Scroll-margin working incorrectly when scrolling down if show-trailing-whitespace is t Alexander Miller
2017-02-19 16:59 ` npostavs
2017-02-19 17:20   ` Eli Zaretskii
2017-02-19 20:56     ` Eli Zaretskii
2017-02-20 17:42       ` npostavs [this message]
2017-02-20 18:02         ` Eli Zaretskii
2017-02-20 18:46           ` npostavs
2017-02-20 19:36             ` Eli Zaretskii
2017-02-25  4:37               ` npostavs

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=87r32siwrh.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=25792@debbugs.gnu.org \
    --cc=alexanderm@web.de \
    --cc=eliz@gnu.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).