diff options
| author | Eli Zaretskii | 2021-02-24 17:43:08 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2021-02-24 17:43:08 +0200 |
| commit | eef185dfc82330198b77b46cf7e48f8142c55ea2 (patch) | |
| tree | ce9ea28800d94f0713ea74a1ff0d5320a7060e68 | |
| parent | 91b37381eaa8db64965249b5a3a377c51d0afa1b (diff) | |
| download | emacs-eef185dfc82330198b77b46cf7e48f8142c55ea2.tar.gz emacs-eef185dfc82330198b77b46cf7e48f8142c55ea2.zip | |
Better support for 'truncate-line' non-nil in the mini-window
* src/xdisp.c (resize_mini_window): Resize the mini-window
when multi-line text is displayed under truncate-lines
non-nil in the minibuffer. (Bug#46718)
| -rw-r--r-- | src/xdisp.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index f86d3527b3d..cd3455aefcf 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -11857,18 +11857,27 @@ resize_mini_window (struct window *w, bool exact_p) | |||
| 11857 | max_height = clip_to_bounds (unit, max_height, windows_height); | 11857 | max_height = clip_to_bounds (unit, max_height, windows_height); |
| 11858 | 11858 | ||
| 11859 | /* Find out the height of the text in the window. */ | 11859 | /* Find out the height of the text in the window. */ |
| 11860 | if (it.line_wrap == TRUNCATE) | 11860 | last_height = 0; |
| 11861 | height = unit; | 11861 | move_it_to (&it, ZV, -1, -1, -1, MOVE_TO_POS); |
| 11862 | else | 11862 | /* If move_it_to moved to the next visible line after EOB, |
| 11863 | { | 11863 | account for the height of the last full line. */ |
| 11864 | last_height = 0; | 11864 | if (it.max_ascent == 0 && it.max_descent == 0) |
| 11865 | move_it_to (&it, ZV, -1, -1, -1, MOVE_TO_POS); | 11865 | { |
| 11866 | if (it.max_ascent == 0 && it.max_descent == 0) | 11866 | height = it.current_y; |
| 11867 | height = it.current_y + last_height; | 11867 | /* Don't add the last line's height if lines are truncated |
| 11868 | else | 11868 | and the text doesn't end in a newline. |
| 11869 | height = it.current_y + it.max_ascent + it.max_descent; | 11869 | FIXME: if the text ends in a newline from a display |
| 11870 | height -= min (it.extra_line_spacing, it.max_extra_line_spacing); | 11870 | property or an overlay string, they lose: the mini-window |
| 11871 | might not show the last empty line. */ | ||
| 11872 | if (!(it.line_wrap == TRUNCATE | ||
| 11873 | && it.current_x <= it.first_visible_x | ||
| 11874 | && ZV_BYTE > 1 | ||
| 11875 | && FETCH_BYTE (ZV_BYTE - 1) != '\n')) | ||
| 11876 | height += last_height; | ||
| 11871 | } | 11877 | } |
| 11878 | else | ||
| 11879 | height = it.current_y + it.max_ascent + it.max_descent; | ||
| 11880 | height -= min (it.extra_line_spacing, it.max_extra_line_spacing); | ||
| 11872 | 11881 | ||
| 11873 | /* Compute a suitable window start. */ | 11882 | /* Compute a suitable window start. */ |
| 11874 | if (height > max_height) | 11883 | if (height > max_height) |