emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master fc0f98a: Fix point position after revert-buffer in tabulated-list


From: Eli Zaretskii
Subject: master fc0f98a: Fix point position after revert-buffer in tabulated-list mode
Date: Sun, 27 Oct 2019 11:08:59 -0400 (EDT)

branch: master
commit fc0f98a8a87ca48b4c3fb0e66d1bd1e2dcc9aa19
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix point position after revert-buffer in tabulated-list mode
    
    * lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
    Don't use count-screen-lines, as it is unreliable when lines
    are truncated and the region ends before a newline (the root
    cause is in vertical-motion, but is very hard to fix there).
    Instead, use vertical-motion directly, as the problems with
    counting/not counting the newline that ends the region are not
    relevant to what we need in this function, which is simply the
    number of the current window line.  (Bug#37941)
---
 lisp/emacs-lisp/tabulated-list.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/tabulated-list.el 
b/lisp/emacs-lisp/tabulated-list.el
index 66a859f..88e7917 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -424,7 +424,12 @@ changing `tabulated-list-sort-key'."
         (setq saved-col (current-column))
          (when (eq (window-buffer) (current-buffer))
            (setq window-line
-                 (count-screen-lines (window-start) (point)))))
+                 (save-excursion
+                   (save-restriction
+                     (widen)
+                     (narrow-to-region (window-start) (point))
+                     (goto-char (point-min))
+                     (vertical-motion (buffer-size)))))))
     ;; Sort the entries, if necessary.
     (when sorter
       (setq entries (sort entries sorter)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]