diff options
| author | Martin Rudalics | 2019-07-22 09:19:18 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2019-07-22 09:19:18 +0200 |
| commit | 8e0ebb9a3cb9beef2f5ff50436fef1c54a3e3c92 (patch) | |
| tree | acabc59171db5611552b1a45aeea2149beefe689 /lisp/window.el | |
| parent | 5ccaee4bbc184c53b262021361bd216af17e80f5 (diff) | |
| download | emacs-8e0ebb9a3cb9beef2f5ff50436fef1c54a3e3c92.tar.gz emacs-8e0ebb9a3cb9beef2f5ff50436fef1c54a3e3c92.zip | |
Handle persistence of windows' scroll bar and fringes settings (Bug#36193)
* doc/lispref/display.texi (Fringe Size/Pos): Document new
argument PERSISTENT of 'set-window-fringes'.
(Scroll Bars): Document new argument PERSISTENT of
'set-window-scroll-bars'. Mention that HORIZONTAL-TYPE must
be 'bottom' to show a horizontal scroll bar on mini windows.
* lisp/window.el (window-min-pixel-height): For mini windows the
minimum height is one line.
(window--min-size-1): Use value returned by
'window-min-pixel-height' when dealing with mini windows.
(window--resize-mini-window): Try to handle horizontal scroll
bars and size restrictions more accurately.
(window--state-put-2): Handle persistence of scroll bar
settings.
* src/frame.c (make_frame): Allow horizontal scroll bars in
mini windows.
(adjust_frame_size): Drop PIXELWISE argument in
'resize_frame_windows' calls.
* src/window.c (set_window_buffer): Don't override WINDOW's
scroll bar and fringe settings when marked as persistent.
(resize_frame_windows): Drop fourth argument PIXELWISE - SIZE
is always specified in terms of pixels. Try to handle height
of mini windows more accurately.
(grow_mini_window, shrink_mini_window): Use body height of
mini window when calculating expected height change. Take
horizontal scroll bars into account.
(struct saved_window): Two new members to handle persistence
of window fringes and scroll bars.
(Fset_window_configuration, save_window_save): Handle
persistence of fringes and scroll bars.
(set_window_fringes, set_window_scroll_bars): New arguments
PERSISTENT. Make dimension checks more accurate.
(Fset_window_fringes): New argument PERSISTENT.
(Fwindow_fringes, Fwindow_scroll_bars): Add PERSISTENT to
return values.
(Fset_window_scroll_bars): New argument PERSISTENT. In
doc-string mention that 'bottom' must be specified to get a
horizontal scroll bar in mini windows.
(compare_window_configurations): Add checks for persistence of
fringes and scroll bars.
* src/window.h (struct window): New boolean slots
'fringes_persistent' and 'scroll_bars_persistent'.
(WINDOW_HAS_HORIZONTAL_SCROLL_BAR): Allow horizontal scroll bars
for mini windows.
(resize_frame_windows): Remove fourth argument of
'resize_frame_windows' in external declaration.
* src/xdisp.c (resize_mini_window): Use box text height to
tell whether mini window height changed.
(set_horizontal_scroll_bar): Set mini window's horizontal
scroll bar when its type is specified as 'bottom'.
* etc/NEWS: Mention new options for 'set-window-fringes' and
'set-window-scroll-bars'.
Diffstat (limited to 'lisp/window.el')
| -rw-r--r-- | lisp/window.el | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/lisp/window.el b/lisp/window.el index 8cb9670ae47..8597f870a5b 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -434,7 +434,8 @@ shorter, explicitly specify the SIZE argument of that function." | |||
| 434 | 434 | ||
| 435 | (defun window-min-pixel-height (&optional window) | 435 | (defun window-min-pixel-height (&optional window) |
| 436 | "Return the minimum pixel height of window WINDOW." | 436 | "Return the minimum pixel height of window WINDOW." |
| 437 | (* (max window-min-height window-safe-min-height) | 437 | (* (max (if (window-minibuffer-p window) 1 window-min-height) |
| 438 | window-safe-min-height) | ||
| 438 | (frame-char-size window))) | 439 | (frame-char-size window))) |
| 439 | 440 | ||
| 440 | ;; This must go to C, finally (or get removed). | 441 | ;; This must go to C, finally (or get removed). |
| @@ -1603,8 +1604,6 @@ return the minimum pixel-size of WINDOW." | |||
| 1603 | value) | 1604 | value) |
| 1604 | (with-current-buffer (window-buffer window) | 1605 | (with-current-buffer (window-buffer window) |
| 1605 | (cond | 1606 | (cond |
| 1606 | ((window-minibuffer-p window) | ||
| 1607 | (if pixelwise (frame-char-height (window-frame window)) 1)) | ||
| 1608 | ((window-size-fixed-p window horizontal ignore) | 1607 | ((window-size-fixed-p window horizontal ignore) |
| 1609 | ;; The minimum size of a fixed size window is its size. | 1608 | ;; The minimum size of a fixed size window is its size. |
| 1610 | (window-size window horizontal pixelwise)) | 1609 | (window-size window horizontal pixelwise)) |
| @@ -2739,30 +2738,32 @@ windows." | |||
| 2739 | (when (window-right window) | 2738 | (when (window-right window) |
| 2740 | (window--resize-reset-1 (window-right window) horizontal))) | 2739 | (window--resize-reset-1 (window-right window) horizontal))) |
| 2741 | 2740 | ||
| 2741 | ;; The following is the internal function used when resizing mini | ||
| 2742 | ;; windows "manually", for example, when dragging a divider between | ||
| 2743 | ;; root and mini window. The routines for automatic minibuffer window | ||
| 2744 | ;; resizing call `window--resize-root-window-vertically' instead. | ||
| 2742 | (defun window--resize-mini-window (window delta) | 2745 | (defun window--resize-mini-window (window delta) |
| 2743 | "Resize minibuffer window WINDOW by DELTA pixels. | 2746 | "Change height of mini window WINDOW by DELTA pixels. |
| 2744 | If WINDOW cannot be resized by DELTA pixels make it as large (or | 2747 | If WINDOW cannot be resized by DELTA pixels make it as large (or |
| 2745 | as small) as possible, but don't signal an error." | 2748 | as small) as possible, but don't signal an error." |
| 2746 | (when (window-minibuffer-p window) | 2749 | (when (window-minibuffer-p window) |
| 2747 | (let* ((frame (window-frame window)) | 2750 | (let* ((frame (window-frame window)) |
| 2748 | (root (frame-root-window frame)) | 2751 | (root (frame-root-window frame)) |
| 2749 | (height (window-pixel-height window)) | 2752 | (height (window-pixel-height window)) |
| 2750 | (min-delta | 2753 | (min-height (+ (frame-char-height frame) |
| 2751 | (- (window-pixel-height root) | 2754 | (- (window-pixel-height window) |
| 2752 | (window-min-size root nil nil t)))) | 2755 | (window-body-height window t)))) |
| 2753 | ;; Sanitize DELTA. | 2756 | (max-delta (- (window-pixel-height root) |
| 2754 | (cond | 2757 | (window-min-size root nil nil t)))) |
| 2755 | ((<= (+ height delta) 0) | 2758 | ;; Don't make mini window too small. |
| 2756 | (setq delta (- (frame-char-height frame) height))) | 2759 | (when (< (+ height delta) min-height) |
| 2757 | ((> delta min-delta) | 2760 | (setq delta (- min-height height))) |
| 2758 | (setq delta min-delta))) | 2761 | ;; Don't make root window too small. |
| 2762 | (when (> delta max-delta) | ||
| 2763 | (setq delta max-delta)) | ||
| 2759 | 2764 | ||
| 2760 | (unless (zerop delta) | 2765 | (unless (zerop delta) |
| 2761 | ;; Resize now. | ||
| 2762 | (window--resize-reset frame) | 2766 | (window--resize-reset frame) |
| 2763 | ;; Ideally we should be able to resize just the last child of root | ||
| 2764 | ;; here. See the comment in `resize-root-window-vertically' for | ||
| 2765 | ;; why we do not do that. | ||
| 2766 | (window--resize-this-window root (- delta) nil nil t) | 2767 | (window--resize-this-window root (- delta) nil nil t) |
| 2767 | (set-window-new-pixel window (+ height delta)) | 2768 | (set-window-new-pixel window (+ height delta)) |
| 2768 | ;; The following routine catches the case where we want to resize | 2769 | ;; The following routine catches the case where we want to resize |
| @@ -5881,7 +5882,7 @@ value can be also stored on disk and read back in a new session." | |||
| 5881 | (let ((scroll-bars (cdr (assq 'scroll-bars state)))) | 5882 | (let ((scroll-bars (cdr (assq 'scroll-bars state)))) |
| 5882 | (set-window-scroll-bars | 5883 | (set-window-scroll-bars |
| 5883 | window (car scroll-bars) (nth 2 scroll-bars) | 5884 | window (car scroll-bars) (nth 2 scroll-bars) |
| 5884 | (nth 3 scroll-bars) (nth 5 scroll-bars))) | 5885 | (nth 3 scroll-bars) (nth 5 scroll-bars) (nth 6 scroll-bars))) |
| 5885 | (set-window-vscroll window (cdr (assq 'vscroll state))) | 5886 | (set-window-vscroll window (cdr (assq 'vscroll state))) |
| 5886 | ;; Adjust vertically. | 5887 | ;; Adjust vertically. |
| 5887 | (if (or (memq window-size-fixed '(t height)) | 5888 | (if (or (memq window-size-fixed '(t height)) |
| @@ -8497,7 +8498,7 @@ parameters of FRAME." | |||
| 8497 | (if parent | 8498 | (if parent |
| 8498 | (frame-native-height parent) | 8499 | (frame-native-height parent) |
| 8499 | (- (nth 3 geometry) (nth 1 geometry)))) | 8500 | (- (nth 3 geometry) (nth 1 geometry)))) |
| 8500 | ;; FRAME'S parent or workarea sizes. Used when no margins | 8501 | ;; FRAME's parent or workarea sizes. Used when no margins |
| 8501 | ;; are specified. | 8502 | ;; are specified. |
| 8502 | (parent-or-workarea | 8503 | (parent-or-workarea |
| 8503 | (if parent | 8504 | (if parent |