mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
fix(popup): fringe/margins adjusted in wrong window
Due to a race condition in some contexts, hooks that adjusted window fringes or margins weren't targeting the windows (usually popups) they were supposed to, often affecting the last selected window instead. This could cause the fringes (or margins) to resize or outright vanish unexpectedly in the wrong windows (e.g. after opening or killing a vterm or eshell popup). Fix: #8346
This commit is contained in:
@ -120,6 +120,8 @@
|
||||
(if (eq major-mode 'eshell-mode)
|
||||
(run-hooks 'eshell-mode-hook)
|
||||
(eshell-mode))
|
||||
(set-window-fringes nil 0 0)
|
||||
(set-window-margins nil 1 nil)
|
||||
(when command
|
||||
(+eshell-run-command command buf)))
|
||||
buf))
|
||||
|
@ -92,9 +92,6 @@ You should use `set-eshell-alias!' to change this.")
|
||||
|
||||
;; UI enhancements
|
||||
(add-hook! 'eshell-mode-hook
|
||||
(defun +eshell-remove-fringes-h ()
|
||||
(set-window-fringes nil 0 0)
|
||||
(set-window-margins nil 1 nil))
|
||||
(defun +eshell-enable-text-wrapping-h ()
|
||||
(visual-line-mode +1)
|
||||
(set-display-table-slot standard-display-table 0 ?\ )))
|
||||
|
@ -256,14 +256,15 @@ Uses `shrink-window-if-larger-than-buffer'."
|
||||
(defun +popup-adjust-fringes-h ()
|
||||
"Hides the fringe in popup windows, restoring them if `+popup-buffer-mode' is
|
||||
disabled."
|
||||
(let ((f (if (bound-and-true-p +popup-buffer-mode) 0)))
|
||||
(set-window-fringes nil f f fringes-outside-margins)))
|
||||
(when (+popup-window-p)
|
||||
(let ((f (if (bound-and-true-p +popup-buffer-mode) 0)))
|
||||
(set-window-fringes nil f f fringes-outside-margins))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +popup-adjust-margins-h ()
|
||||
"Creates padding for the popup window determined by `+popup-margin-width',
|
||||
restoring it if `+popup-buffer-mode' is disabled."
|
||||
(when +popup-margin-width
|
||||
(when (and +popup-margin-width (+popup-window-p))
|
||||
(unless (memq (window-parameter nil 'window-side) '(left right))
|
||||
(let ((m (if (bound-and-true-p +popup-buffer-mode) +popup-margin-width)))
|
||||
(set-window-margins nil m m)))))
|
||||
|
Reference in New Issue
Block a user