diff options
| author | Stefan Monnier | 2020-12-12 10:16:42 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2020-12-12 10:16:42 -0500 |
| commit | d165b5a46b2a84c637a80200ad6bcf164bbfa77b (patch) | |
| tree | 2b4ac38642ac31c0b2f29700d93aef0c17308a42 /src | |
| parent | adbb4eacc2a984c0fc0b65ec761368fd9067d6c5 (diff) | |
| download | emacs-d165b5a46b2a84c637a80200ad6bcf164bbfa77b.tar.gz emacs-d165b5a46b2a84c637a80200ad6bcf164bbfa77b.zip | |
New variable `redisplay_adhoc_scroll_in_resize_mini_windows`
* src/xdisp.c (syms_of_xdisp): Define it.
(resize_mini_window): Obey it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 689b87df421..96dd4fade25 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -11751,9 +11751,10 @@ resize_mini_window (struct window *w, bool exact_p) | |||
| 11751 | return false; | 11751 | return false; |
| 11752 | 11752 | ||
| 11753 | /* By default, start display at the beginning. */ | 11753 | /* By default, start display at the beginning. */ |
| 11754 | set_marker_both (w->start, w->contents, | 11754 | if (redisplay_adhoc_scroll_in_resize_mini_windows) |
| 11755 | BUF_BEGV (XBUFFER (w->contents)), | 11755 | set_marker_both (w->start, w->contents, |
| 11756 | BUF_BEGV_BYTE (XBUFFER (w->contents))); | 11756 | BUF_BEGV (XBUFFER (w->contents)), |
| 11757 | BUF_BEGV_BYTE (XBUFFER (w->contents))); | ||
| 11757 | 11758 | ||
| 11758 | /* Nil means don't try to resize. */ | 11759 | /* Nil means don't try to resize. */ |
| 11759 | if ((NILP (Vresize_mini_windows) | 11760 | if ((NILP (Vresize_mini_windows) |
| @@ -11812,27 +11813,32 @@ resize_mini_window (struct window *w, bool exact_p) | |||
| 11812 | if (height > max_height) | 11813 | if (height > max_height) |
| 11813 | { | 11814 | { |
| 11814 | height = (max_height / unit) * unit; | 11815 | height = (max_height / unit) * unit; |
| 11815 | init_iterator (&it, w, ZV, ZV_BYTE, NULL, DEFAULT_FACE_ID); | 11816 | if (redisplay_adhoc_scroll_in_resize_mini_windows) |
| 11816 | move_it_vertically_backward (&it, height - unit); | 11817 | { |
| 11817 | /* The following move is usually a no-op when the stuff | 11818 | init_iterator (&it, w, ZV, ZV_BYTE, NULL, DEFAULT_FACE_ID); |
| 11818 | displayed in the mini-window comes entirely from buffer | 11819 | move_it_vertically_backward (&it, height - unit); |
| 11819 | text, but it is needed when some of it comes from overlay | 11820 | /* The following move is usually a no-op when the stuff |
| 11820 | strings, especially when there's an after-string at ZV. | 11821 | displayed in the mini-window comes entirely from buffer |
| 11821 | This happens with some completion packages, like | 11822 | text, but it is needed when some of it comes from overlay |
| 11822 | icomplete, ido-vertical, etc. With those packages, if we | 11823 | strings, especially when there's an after-string at ZV. |
| 11823 | don't force w->start to be at the beginning of a screen | 11824 | This happens with some completion packages, like |
| 11824 | line, important parts of the stuff in the mini-window, | 11825 | icomplete, ido-vertical, etc. With those packages, if we |
| 11825 | such as user prompt, will be hidden from view. */ | 11826 | don't force w->start to be at the beginning of a screen |
| 11826 | move_it_by_lines (&it, 0); | 11827 | line, important parts of the stuff in the mini-window, |
| 11827 | start = it.current.pos; | 11828 | such as user prompt, will be hidden from view. */ |
| 11828 | /* Prevent redisplay_window from recentering, and thus from | 11829 | move_it_by_lines (&it, 0); |
| 11829 | overriding the window-start point we computed here. */ | 11830 | start = it.current.pos; |
| 11830 | w->start_at_line_beg = false; | 11831 | /* Prevent redisplay_window from recentering, and thus from |
| 11832 | overriding the window-start point we computed here. */ | ||
| 11833 | w->start_at_line_beg = false; | ||
| 11834 | SET_MARKER_FROM_TEXT_POS (w->start, start); | ||
| 11835 | } | ||
| 11831 | } | 11836 | } |
| 11832 | else | 11837 | else |
| 11833 | SET_TEXT_POS (start, BEGV, BEGV_BYTE); | 11838 | { |
| 11834 | 11839 | SET_TEXT_POS (start, BEGV, BEGV_BYTE); | |
| 11835 | SET_MARKER_FROM_TEXT_POS (w->start, start); | 11840 | SET_MARKER_FROM_TEXT_POS (w->start, start); |
| 11841 | } | ||
| 11836 | 11842 | ||
| 11837 | if (EQ (Vresize_mini_windows, Qgrow_only)) | 11843 | if (EQ (Vresize_mini_windows, Qgrow_only)) |
| 11838 | { | 11844 | { |
| @@ -35502,6 +35508,14 @@ The initial frame is not displayed anywhere, so skipping it is | |||
| 35502 | best except in special circumstances such as running redisplay tests | 35508 | best except in special circumstances such as running redisplay tests |
| 35503 | in batch mode. */); | 35509 | in batch mode. */); |
| 35504 | redisplay_skip_initial_frame = true; | 35510 | redisplay_skip_initial_frame = true; |
| 35511 | |||
| 35512 | DEFVAR_BOOL ("redisplay-adhoc-scroll-in-resize-mini-windows", | ||
| 35513 | redisplay_adhoc_scroll_in_resize_mini_windows, | ||
| 35514 | doc: /* If nil always use normal scrolling in minibuffer windows. | ||
| 35515 | Otherwise, use custom-tailored code after resizing minibuffer windows to try | ||
| 35516 | and display the most important part of the minibuffer. */); | ||
| 35517 | /* See bug#43519 for some discussion around this. */ | ||
| 35518 | redisplay_adhoc_scroll_in_resize_mini_windows = true; | ||
| 35505 | } | 35519 | } |
| 35506 | 35520 | ||
| 35507 | 35521 | ||