Commit d9330f43 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(jit-lock-after-change): Don't assume point is at START.

parent a895a5a5
...@@ -439,20 +439,22 @@ This function ensures that lines following the change will be refontified ...@@ -439,20 +439,22 @@ This function ensures that lines following the change will be refontified
in case the syntax of those lines has changed. Refontification in case the syntax of those lines has changed. Refontification
will take place when text is fontified stealthily." will take place when text is fontified stealthily."
(when jit-lock-mode (when jit-lock-mode
;; It's important that the `fontified' property be set from the (save-excursion
;; beginning of the line, else font-lock will properly change the (with-buffer-prepared-for-jit-lock
;; text's face, but the display will have been done already and will ;; It's important that the `fontified' property be set from the
;; be inconsistent with the buffer's content. ;; beginning of the line, else font-lock will properly change the
(setq start (line-beginning-position)) ;; text's face, but the display will have been done already and will
;; Make sure we change at least one char (in case of deletions). ;; be inconsistent with the buffer's content.
(setq end (min (max end (1+ start)) (point-max))) (goto-char start)
;; Request refontification. (setq start (line-beginning-position))
(with-buffer-prepared-for-jit-lock ;; Make sure we change at least one char (in case of deletions).
(put-text-property start end 'fontified nil)) (setq end (min (max end (1+ start)) (point-max)))
;; Mark the change for deferred contextual refontification. ;; Request refontification.
(when jit-lock-first-unfontify-pos (put-text-property start end 'fontified nil))
(setq jit-lock-first-unfontify-pos ;; Mark the change for deferred contextual refontification.
(min jit-lock-first-unfontify-pos start))))) (when jit-lock-first-unfontify-pos
(setq jit-lock-first-unfontify-pos
(min jit-lock-first-unfontify-pos start))))))
(provide 'jit-lock) (provide 'jit-lock)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment