Skip to content

Commit

Permalink
display buffer window before starting comint to fix size detection
Browse files Browse the repository at this point in the history
showing the buffer in a window before starting comint (instead of the
other way around) means that pytest's terminal width detection works
more reliably, which fixes display issues in case a new window was
opened (e.g. first test run).

fixes #48
  • Loading branch information
wbolster committed Nov 7, 2021
1 parent 31ae5e0 commit 65ac155
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python-pytest.el
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ With a prefix ARG, allow editing."
(let* ((buffer (python-pytest--get-buffer))
(process (get-buffer-process buffer)))
(with-current-buffer buffer
(display-buffer buffer)
(when (comint-check-proc buffer)
(unless (or compilation-always-kill
(yes-or-no-p "Kill running pytest process?"))
Expand All @@ -389,8 +390,7 @@ With a prefix ARG, allow editing."
(make-comint-in-buffer "pytest" buffer "sh" nil "-c" command)
(run-hooks 'python-pytest-started-hook)
(setq process (get-buffer-process buffer))
(set-process-sentinel process #'python-pytest--process-sentinel)
(display-buffer buffer))))
(set-process-sentinel process #'python-pytest--process-sentinel))))

(defun python-pytest--shell-quote (s)
"Quote S for use in a shell command. Like `shell-quote-argument', but prettier."
Expand Down

0 comments on commit 65ac155

Please sign in to comment.