bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#43519: 28.0.50; Overlay at end of minibuf hides minibuf's real conte


From: Stefan Monnier
Subject: bug#43519: 28.0.50; Overlay at end of minibuf hides minibuf's real content
Date: Wed, 23 Sep 2020 14:35:00 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>> IOW, you leave it entirely to the generic window-display code to select
>>> window-start based just on the value of point?
>> Yes.  It seems to work very well. Even the corner case regression above
>> doesn't seem very serious and can be addressed using the
>> scroll_conservatively code.
> A last note: w->start has already been set to its default value (BEGV) just
>   after entering resize_mini_window(), so the else part in your patch is not
>  necessary anymore.  Your code has the same effect as simply doing:
> if (height > max_height) height = (max_height / unit) * unit;
> in place of the "Compute a suitable window start" part.

Indeed, except that I (later) also removed that setting of w->start.


        Stefan


diff --git a/src/xdisp.c b/src/xdisp.c
index c05f97173d..c73212174a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11799,10 +11799,10 @@ resize_mini_window_1 (void *a1, Lisp_Object exactly)
    means size the window exactly to the size needed.  Otherwise, it's
    only enlarged until W's buffer is empty.
 
-   Set W->start to the right place to begin display.  If the whole
-   contents fit, start at the beginning.  Otherwise, start so as
-   to make the end of the contents appear.  This is particularly
-   important for y-or-n-p, but seems desirable generally.
+   If the whole contents fit, set W->start at the beginning.
+   Otherwise, let redisplay do its thing to make sure point is displayed,
+   so we can control which part is more important by placing point
+   accordingly.
 
    Value is true if the window height has been changed.  */
 
@@ -11824,9 +11824,10 @@ resize_mini_window (struct window *w, bool exact_p)
     return false;
 
   /* By default, start display at the beginning.  */
-  set_marker_both (w->start, w->contents,
-              BUF_BEGV (XBUFFER (w->contents)),
-              BUF_BEGV_BYTE (XBUFFER (w->contents)));
+  /* bug#43519: Let the redisplay choose the window start!
+   * set_marker_both (w->start, w->contents,
+   *            BUF_BEGV (XBUFFER (w->contents)),
+   *            BUF_BEGV_BYTE (XBUFFER (w->contents))); */
 
   /* Nil means don't try to resize.  */
   if ((NILP (Vresize_mini_windows)
@@ -11885,24 +11886,18 @@ resize_mini_window (struct window *w, bool exact_p)
       if (height > max_height)
        {
          height = (max_height / unit) * unit;
-     init_iterator (&it, w, ZV, ZV_BYTE, NULL, DEFAULT_FACE_ID);
-     move_it_vertically_backward (&it, height - unit);
-     /* The following move is usually a no-op when the stuff
-        displayed in the mini-window comes entirely from buffer
-        text, but it is needed when some of it comes from overlay
-        strings, especially when there's an after-string at ZV.
-        This happens with some completion packages, like
-        icomplete, ido-vertical, etc.  With those packages, if we
-        don't force w->start to be at the beginning of a screen
-        line, important parts of the stuff in the mini-window,
-        such as user prompt, will be hidden from view.  */
-     move_it_by_lines (&it, 0);
-     start = it.current.pos;
+   /* bug#43519: Let the redisplay choose the window start!
+           *
+           * init_iterator (&it, w, ZV, ZV_BYTE, NULL, DEFAULT_FACE_ID);
+    * move_it_vertically_backward (&it, height - unit);
+    * start = it.current.pos; */
        }
       else
-   SET_TEXT_POS (start, BEGV, BEGV_BYTE);
+ {
+   SET_TEXT_POS (start, BEGV, BEGV_BYTE);
 
-      SET_MARKER_FROM_TEXT_POS (w->start, start);
+          SET_MARKER_FROM_TEXT_POS (w->start, start);
+        }
 
       if (EQ (Vresize_mini_windows, Qgrow_only))
        {
@@ -18923,6 +18918,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))
@@ -18933,7 +18929,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)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]