]> git.eshelyaron.com Git - emacs.git/commitdiff
(repos-count-screen-lines): Narrow without changing point-min
authorDmitry Gutov <dgutov@yandex.ru>
Thu, 14 Nov 2019 21:41:07 +0000 (23:41 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Thu, 14 Nov 2019 21:43:33 +0000 (23:43 +0200)
* lisp/reposition.el (repos-count-screen-lines): Narrow without
changing point-min.  It wasn't necessary for vertical-motion to
work, and it had some adverse effects on how font-lock rules were
applied
(https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00522.html).
This can also be an alternative fix for bug#38049.

lisp/reposition.el

index 22f9986efb5fe26fb0599b606a1176d9f7787cc4..111bc0841f41af9c85723495faf45e82122f4628 100644 (file)
@@ -170,12 +170,13 @@ first comment line visible (if point is in a comment)."
 
 ;;; Auxiliary functions
 
+
 ;; Return number of screen lines between START and END.
 (defun repos-count-screen-lines (start end)
   (save-excursion
     (save-restriction
-      (narrow-to-region start end)
-      (goto-char (point-min))
+      (narrow-to-region (point-min) end)
+      (goto-char start)
       (vertical-motion (- (point-max) (point-min))))))
 
 ;; Return number of screen lines between START and END; returns a negative