diff --git a/test/test-2.txt b/test/test-2.txt deleted file mode 100644 index 1cf31fd..0000000 --- a/test/test-2.txt +++ /dev/null @@ -1,2 +0,0 @@ -○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○ - └──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○──○ diff --git a/vundo.el b/vundo.el index d698b4a..0165aaf 100644 --- a/vundo.el +++ b/vundo.el @@ -771,15 +771,23 @@ This function modifies `vundo--prev-mod-list', (unless (eq (vundo--latest-buffer-state mod-list) latest-state) (vundo--draw-tree mod-list)) - ;; Highlight current node. - (vundo--highlight-node (vundo--current-node mod-list)) - (goto-char (vundo-m-point (vundo--current-node mod-list))) - ;; Update the face of the last saved node. - (when-let (((and vundo-highlight-saved-nodes vundo--last-saved-idx)) - ((>= vundo--last-saved-idx 0)) - (last-saved-node (aref mod-list vundo--last-saved-idx)) - (pt (vundo-m-point last-saved-node))) - (put-text-property (1- pt) pt 'face 'vundo-last-saved)) + + (let ((current-node (vundo--current-node mod-list))) + ;; Highlight current node. + (vundo--highlight-node current-node) + (goto-char (vundo-m-point current-node)) + ;; Update the face of the last saved node. + (when vundo-highlight-saved-nodes + ;; if the associated buffer is unmodified, it is the latest + ;; saved (although it will have no prev-saved-ts). + (if (with-current-buffer orig-buffer (not (buffer-modified-p))) + (setq vundo--last-saved-idx (vundo-m-idx current-node))) + (when-let ((vundo--last-saved-idx) + ((>= vundo--last-saved-idx 0)) + (last-saved-node (aref mod-list vundo--last-saved-idx)) + (pt (vundo-m-point last-saved-node))) + (put-text-property (1- pt) pt 'face 'vundo-last-saved)))) + ;; Update cache. (setq vundo--prev-mod-list mod-list vundo--prev-mod-hash mod-hash