emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Support "\n" in icomplete-separator


From: Stefan Monnier
Subject: Re: [PATCH] Support "\n" in icomplete-separator
Date: Tue, 17 Nov 2020 09:05:31 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> I was not thinking about that feature, which indeed is much more ambitious,
> but about the `minibuffer-scroll-generic' feature you proposed, which would
> have solved the issue at hand, and for which you wrote a (partial) patch.

Ah you mean the patch where I basically remove the ad-hoc scrolling code
from resize_mini_window?  Eli doesn't like it, so it would have to be
activated by a config variable (and deactivated by default).

I'm using it in my local Emacs (see patch below) and have been tempted
to add it to master (under the control of a boolean config variable),
but its effect is so minor that I'm not sure it's worth the trouble.
If you think you can make use of it, then I can clean it up and push it.

> Now I think indeed that just doing what Eli wants is the best way to
> move forward.

Sounds about right.


        Stefan


diff --git a/src/xdisp.c b/src/xdisp.c
index 021c99dec4..d953120e28 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11814,10 +11814,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.  */
 
@@ -11839,9 +11839,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)
@@ -11900,27 +11901,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;
-         /* Prevent redisplay_window from recentering, and thus from
-            overriding the window-start point we computed here.  */
-         w->start_at_line_beg = false;
+         /* 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))
        {




reply via email to

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