fix: magnifier cursor visible, line nums hidden, M-x/which-key safe
This commit is contained in:
26
config.el
26
config.el
@@ -850,8 +850,13 @@ Keeps the status bar and tab bar fully visible at any zoom level.")
|
||||
|
||||
(defun my/mag--switch-source ()
|
||||
"Switch magnifier to track the current buffer."
|
||||
(cl-block my/mag--switch-source
|
||||
(let* ((new-source (current-buffer))
|
||||
(mag-name (format "*mag:%s*" (buffer-name new-source))))
|
||||
;; Don't switch to transient/minibuffer buffers
|
||||
(when (or (minibufferp new-source)
|
||||
(string-prefix-p " " (buffer-name new-source)))
|
||||
(cl-return-from my/mag--switch-source))
|
||||
(my/mag--kill-indirect)
|
||||
(setq my/mag--source new-source)
|
||||
(setq my/mag--buffer (make-indirect-buffer new-source mag-name t))
|
||||
@@ -859,12 +864,20 @@ Keeps the status bar and tab bar fully visible at any zoom level.")
|
||||
(set-window-buffer my/mag--window my/mag--buffer)
|
||||
(with-selected-window my/mag--window
|
||||
(text-scale-set my/mag--zoom-level)
|
||||
(setq-local cursor-type nil)
|
||||
(setq-local scroll-margin 0)))))
|
||||
(setq-local cursor-type 'box)
|
||||
(setq-local scroll-margin 0)
|
||||
(when (bound-and-true-p display-line-numbers-mode)
|
||||
(display-line-numbers-mode -1))
|
||||
(when (bound-and-true-p hl-line-mode)
|
||||
(hl-line-mode -1)))))))
|
||||
|
||||
(defun my/mag--sync ()
|
||||
"Sync magnified pane to current cursor position."
|
||||
(when my/mag--active
|
||||
;; Skip when minibuffer is active (M-x, vertico, which-key, etc.)
|
||||
(when (or (active-minibuffer-window)
|
||||
(window-minibuffer-p))
|
||||
(cl-return-from my/mag--sync))
|
||||
;; Ignore if we're in the magnifier pane itself
|
||||
(when (eq (selected-window) my/mag--window)
|
||||
(cl-return-from my/mag--sync))
|
||||
@@ -884,6 +897,7 @@ Keeps the status bar and tab bar fully visible at any zoom level.")
|
||||
(defun my/mag--on-window-change ()
|
||||
"Clean up if magnifier window was closed by user."
|
||||
(when (and my/mag--active
|
||||
(not (active-minibuffer-window))
|
||||
(not (and my/mag--window (window-live-p my/mag--window))))
|
||||
(my/mag--disable)))
|
||||
|
||||
@@ -904,8 +918,12 @@ Keeps the status bar and tab bar fully visible at any zoom level.")
|
||||
(set-window-buffer my/mag--window my/mag--buffer)
|
||||
(with-selected-window my/mag--window
|
||||
(text-scale-set my/mag--zoom-level)
|
||||
(setq-local cursor-type nil)
|
||||
(setq-local scroll-margin 0))
|
||||
(setq-local cursor-type 'box)
|
||||
(setq-local scroll-margin 0)
|
||||
(when (bound-and-true-p display-line-numbers-mode)
|
||||
(display-line-numbers-mode -1))
|
||||
(when (bound-and-true-p hl-line-mode)
|
||||
(hl-line-mode -1)))
|
||||
(setq my/mag--active t)
|
||||
(add-hook 'post-command-hook #'my/mag--sync)
|
||||
(add-hook 'window-configuration-change-hook #'my/mag--on-window-change)
|
||||
|
||||
Reference in New Issue
Block a user