Skip to content

Commit

Permalink
fix: Use dedicated window
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed May 26, 2024
1 parent 5ff66f1 commit 28e9104
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Eask
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(package "undo-tree-vf"
"0.1.0"
"visualizer follow mode for undo-tree")
"Visualizer follow mode for undo-tree")

(website-url "https://github.com/jcs-elpa/undo-tree-vf")
(keywords "convenience")
Expand Down
12 changes: 8 additions & 4 deletions undo-tree-vf.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; undo-tree-vf.el --- visualizer follow mode for undo-tree -*- lexical-binding: t; -*-
;;; undo-tree-vf.el --- Visualizer follow mode for undo-tree -*- lexical-binding: t; -*-

;; Copyright (C) 2022-2024 Shen, Jen-Chieh

Expand Down Expand Up @@ -26,7 +26,7 @@

;;; Commentary:
;;
;; visualizer follow mode for undo-tree.
;; Visualizer follow mode for undo-tree.
;;

;;; Code:
Expand All @@ -35,7 +35,7 @@
(require 'fill-page)

(defgroup undo-tree-vf nil
"visualizer follow mode for undo-tree."
"Visualizer follow mode for undo-tree."
:prefix "undo-tree-vf-"
:group 'tool
:link '(url-link :tag "Repository" "https://github.com/jcs-elpa/undo-tree-vf"))
Expand Down Expand Up @@ -108,7 +108,11 @@ If `undo-tree-mode' is not valid, we call undo/redo function according to ARG"
(defun undo-tree-vf--visualize ()
"Call `undo-tree-visualize' only in window that has higher height."
(save-window-excursion (undo-tree-visualize))
(with-selected-window (get-largest-window nil nil t)
(when (< (length (window-list)) 2)
(display-buffer undo-tree-visualizer-buffer-name
`((display-buffer-in-direction)
(dedicated . t))))
(with-selected-window (get-largest-window nil t t)
(switch-to-buffer undo-tree-visualizer-buffer-name)
(undo-tree-vf--recenter-top-bottom)
(fill-page-if-unfill)))
Expand Down

0 comments on commit 28e9104

Please sign in to comment.