Skip to content

Commit

Permalink
Fix window-start restoring bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomohiro Matsuyama committed Dec 3, 2012
1 parent 7c38173 commit 0ffa738
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions popwin.el
Expand Up @@ -487,6 +487,9 @@ window will not be selected."
(when (popwin:window-deletable-p popwin:popup-window)
(delete-window popwin:popup-window))
(popwin:restore-window-outline (car (window-tree)) popwin:window-outline)
;; Call `redisplay' here so `window-start' could be set
;; prior to the point change of the master buffer.
(redisplay)
(when (and (not keep-selected)
(window-live-p popwin:selected-window))
(select-window popwin:selected-window)))
Expand Down
20 changes: 19 additions & 1 deletion test/popwin-test.el
Expand Up @@ -398,13 +398,31 @@

(ert-deftest popwin-restore-window-start ()
(popwin-test:common
(insert "foo\nbar\n")
(insert (make-string 100 ?\n))
(set-window-start nil (point-max))
(popwin:popup-buffer buf2)
(set-window-start (get-buffer-window buf1) (point-min))
(popwin:close-popup-window)
(should (eq (current-buffer) buf1))
(should (eq (window-start) (point-max)))))

(ert-deftest popwin-restore-window-start/*help* ()
(require 'help-mode)
(describe-function 'popwin:find-file)
(switch-to-buffer (help-buffer))
(goto-char (point-min))
(should (search-forward "popwin.e" (point-max) t))
(call-interactively 'push-button)
(goto-char (point-max))
(describe-function 'popwin:popup-buffer)
(switch-to-buffer (help-buffer))
(goto-char (point-min))
(should (search-forward "popwin.e" (point-max) t))
(call-interactively 'push-button)
(sit-for 0)
(beginning-of-line)
(should (search-forward "popwin:popup-buffer" (line-end-position) t)))

(ert-deftest popwin-original-display-last-buffer ()
(popwin-test:common
(popwin:popup-buffer buf2)
Expand Down

0 comments on commit 0ffa738

Please sign in to comment.