]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix problem with multiline fontification in interactive Python
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 13 Oct 2021 16:44:35 +0000 (18:44 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 13 Oct 2021 17:00:31 +0000 (19:00 +0200)
* lisp/progmodes/python.el
(python-shell-font-lock-post-command-hook): When doing multi-line
(`C-c SPC') inputs, remove all the preceding lines when doing
fontification (bug#47657).

lisp/progmodes/python.el

index 75aae23051a631ae8d6b010e7765bf0a81c9e354..5819f59315baddf9541ea4dc41b6f2d1c277b573 100644 (file)
@@ -2724,16 +2724,12 @@ goes wrong and syntax highlighting in the shell gets messed up."
              (deactivate-mark nil)
              (start-pos prompt-end)
              (buffer-undo-list t)
-             (font-lock-buffer-pos nil)
              (replacement
               (python-shell-font-lock-with-font-lock-buffer
-                (delete-region (line-beginning-position)
-                               (point-max))
-                (setq font-lock-buffer-pos (point))
+                (delete-region (point-min) (point-max))
                 (insert input)
                 (font-lock-ensure)
-                (buffer-substring font-lock-buffer-pos
-                                  (point-max))))
+                (buffer-string)))
              (replacement-length (length replacement))
              (i 0))
         ;; Inject text properties to get input fontified.