Skip to content

Commit

Permalink
fix: transient frame size is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
seagle0128 committed Nov 18, 2024
1 parent 133524c commit 66e2ed1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lisp/init-vcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@
(when (childframe-completion-workable-p)
(use-package transient-posframe
:diminish
:after posframe transient
:defines posframe-border-width
:custom-face
(transient-posframe ((t (:inherit tooltip))))
(transient-posframe-border ((t (:inherit posframe-border :background unspecified))))
:hook (after-init . transient-posframe-mode)
:init
(setq transient-posframe-border-width posframe-border-width
transient-posframe-min-height nil
transient-posframe-min-width 80
transient-posframe-min-height nil
transient-posframe-poshandler 'posframe-poshandler-frame-center
transient-posframe-parameters '((left-fringe . 8)
(right-fringe . 8)))
Expand All @@ -82,12 +83,12 @@
(when (posframe-workable-p)
(let* ((posframe
(posframe-show buffer
:height (with-current-buffer buffer (1- (count-screen-lines (point-min) (point-max))))
:font transient-posframe-font
:position (point)
:poshandler transient-posframe-poshandler
:background-color (face-attribute 'transient-posframe :background nil t)
:foreground-color (face-attribute 'transient-posframe :foreground nil t)
:initialize #'transient-posframe--initialize
:min-width transient-posframe-min-width
:min-height transient-posframe-min-height
:internal-border-width transient-posframe-border-width
Expand All @@ -96,6 +97,20 @@
(frame-selected-window posframe))))
(advice-add #'transient-posframe--show-buffer :override #'my-transient-posframe--show-buffer)

(setq transient-mode-line-format nil) ; without line

(defun transient-posframe--initialize ()
"Initialize transient posframe."
(setq window-resize-pixelwise t)
(setq window-size-fixed nil))

(defun transient-posframe--resize (window)
"Resize transient posframe."
(fit-frame-to-buffer-1 (window-frame window)
nil transient-posframe-min-height
nil transient-posframe-min-width))
(advice-add 'transient--fit-window-to-buffer :override #'transient-posframe--resize)

(defun my-transient-posframe--hide ()
"Hide transient posframe."
(posframe-hide transient--buffer-name))
Expand Down

0 comments on commit 66e2ed1

Please sign in to comment.