mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Avoid extra lines in python-shell font lock buffer (Bug#33959)
* lisp/progmodes/python.el (python-shell-font-lock-comint-output-filter-function): Avoid writing a newline to the font lock buffer when receiving an empty string.
This commit is contained in:
parent
5f67809a8f
commit
ab67287872
1 changed files with 13 additions and 12 deletions
|
|
@ -2600,18 +2600,19 @@ goes wrong and syntax highlighting in the shell gets messed up."
|
|||
|
||||
(defun python-shell-font-lock-comint-output-filter-function (output)
|
||||
"Clean up the font-lock buffer after any OUTPUT."
|
||||
(if (let ((output (ansi-color-filter-apply output)))
|
||||
(and (python-shell-comint-end-of-output-p output)
|
||||
;; Assume "..." represents a continuation prompt.
|
||||
(not (string-match "\\.\\.\\." output))))
|
||||
;; If output ends with an initial (not continuation) input prompt
|
||||
;; then the font-lock buffer must be cleaned up.
|
||||
(python-shell-font-lock-cleanup-buffer)
|
||||
;; Otherwise just add a newline.
|
||||
(python-shell-font-lock-with-font-lock-buffer
|
||||
(goto-char (point-max))
|
||||
(newline)))
|
||||
output)
|
||||
(unless (string= output "") ;; See Bug#33959.
|
||||
(if (let ((output (ansi-color-filter-apply output)))
|
||||
(and (python-shell-comint-end-of-output-p output)
|
||||
;; Assume "..." represents a continuation prompt.
|
||||
(not (string-match "\\.\\.\\." output))))
|
||||
;; If output ends with an initial (not continuation) input prompt
|
||||
;; then the font-lock buffer must be cleaned up.
|
||||
(python-shell-font-lock-cleanup-buffer)
|
||||
;; Otherwise just add a newline.
|
||||
(python-shell-font-lock-with-font-lock-buffer
|
||||
(goto-char (point-max))
|
||||
(newline)))
|
||||
output))
|
||||
|
||||
(defun python-shell-font-lock-post-command-hook ()
|
||||
"Fontifies current line in shell buffer."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue