diff --git a/modules/ui/vc-gutter/config.el b/modules/ui/vc-gutter/config.el index d54f44a50..4c9eac6c7 100644 --- a/modules/ui/vc-gutter/config.el +++ b/modules/ui/vc-gutter/config.el @@ -193,4 +193,19 @@ Respects `diff-hl-disable-on-remote'." (defadvice! +vc-gutter--kill-diff-hl-thread-a (&optional buf) :before #'kill-buffer (with-current-buffer (or buf (current-buffer)) - (+vc-gutter--kill-thread t)))) + (+vc-gutter--kill-thread t))) + + ;; HACK: diff-hl won't be visible in TTY frames, but there's no simple way to + ;; use the fringe in GUI Emacs and use the margin in the terminal *AND* + ;; support daemon users, so we need more than a static `display-graphic-p' + ;; check at startup. + (when (modulep! :os tty) + (put 'diff-hl-mode 'last (display-graphic-p)) + (add-hook! 'doom-switch-window-hook + (defun +vc-gutter-use-margins-in-tty-h () + (let ((graphic? (display-graphic-p))) + (unless (and global-diff-hl-mode (eq (get 'diff-hl-mode 'last) graphic?)) + (global-diff-hl-mode -1) + (diff-hl-margin-mode (if graphic? -1 +1)) + (global-diff-hl-mode +1) + (put 'diff-hl-mode 'last graphic?)))))))