emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/csv-mode 7e5e6bd 29/34: * packages/csv-mode/csv-mode.el


From: Stefan Monnier
Subject: [elpa] externals/csv-mode 7e5e6bd 29/34: * packages/csv-mode/csv-mode.el (csv-align--cursor-truncated): Fix C-e case
Date: Sun, 29 Nov 2020 18:46:17 -0500 (EST)

branch: externals/csv-mode
commit 7e5e6bd28ac97a9bae97b49bbf2b0e38b4f9ed8a
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * packages/csv-mode/csv-mode.el (csv-align--cursor-truncated): Fix C-e case
---
 csv-mode.el | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/csv-mode.el b/csv-mode.el
index 73d34bb..d8302b4 100644
--- a/csv-mode.el
+++ b/csv-mode.el
@@ -1464,9 +1464,20 @@ setting works better)."
                                'selective-display))))
     (if ellipsis (length ellipsis) 3)))
 
-(defun csv-align--cursor-truncated (window _oldpos dir)
+(defun csv-align--cursor-truncated (window oldpos dir)
+  ;; FIXME: Neither the `entered' nor the `left' event are guaranteed
+  ;; to be sent, and for the `left' case, even when we do get called,
+  ;; it may be unclear where the revealed text was (it's somewhere around
+  ;; `oldpos', but that position can be stale).
+  ;; Worse, if we have several windows displaying the buffer, when one
+  ;; cursor leaves we may need to keep the text revealed because of
+  ;; another window's cursor.
   (let* ((prop (if (eq dir 'entered) 'invisible 'csv--revealed))
-         (pos (window-point window))
+         (pos (cond
+               ((eq dir 'entered) (window-point window))
+               (t (max (point-min)
+                       (min (point-max)
+                            (or oldpos (window-point window)))))))
          (start (cond
                  ((and (> pos (point-min))
                        (eq (get-text-property (1- pos) prop) 'csv-truncate))



reply via email to

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