Subject: bug#44070: 28.0.50; Minibuffer display "jumps" upon minor edit

From: Eli Zaretskii <[email-masked]>
Date: Mon, 19 Oct 2020 19:34:01 +0300

> From: Stefan Monnier <[email-masked]>
> Date: Sun, 18 Oct 2020 18:09:55 -0400
> 
> diff --git a/lisp/simple.el b/lisp/simple.el
> index d6fce922c4..41aba2ddc3 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -1129,7 +1129,7 @@ end-of-buffer
>  	 ;; If the end of the buffer is not already on the screen,
>  	 ;; then scroll specially to put it near, but not at, the bottom.
>  	 (overlay-recenter (point))
> -	 (recenter -3))))
> +	 (recenter (if (window-minibuffer-p) -1 -3)))))

This should have a comment that explains the reason for the
difference.  (Btw, does this DTRT when the text in the minibuffer has
a newline at the end?)

> --- a/src/xdisp.c
> +++ b/src/xdisp.c
> @@ -18820,6 +18820,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
>  
>    /* Try to scroll by specified few lines.  */
>    if ((0 < scroll_conservatively
> +       || MINI_WINDOW_P (w)
>         || 0 < emacs_scroll_step
>         || temp_scroll_step
>         || NUMBERP (BVAR (current_buffer, scroll_up_aggressively))
> @@ -18830,7 +18831,9 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
>        /* The function returns -1 if new fonts were loaded, 1 if
>  	 successful, 0 if not successful.  */
>        int ss = try_scrolling (window, just_this_one_p,
> -			      scroll_conservatively,
> +			      (MINI_WINDOW_P (w)
> +			       ? SCROLL_LIMIT + 1
> +			       : scroll_conservatively),
>  			      emacs_scroll_step,
>  			      temp_scroll_step, last_line_misfit);
>        switch (ss)

If we want the minibuffer behave as if scroll-conservatively was set,
why not simply set scroll-conservatively in each minibuffer?  We could
then have a user option, by default on, to do that, and let users who
like the current (mis)behavior continue having that.  As a nice bonus,
we will then be sure the change doesn't affect echo-area messages,
only editing in the minibuffer.

WDYT?