[Top][All Lists]

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

[elpa] master 68e8ac3: * packages/csv-mode/csv-mode.el (csv-align--curso

From: Stefan Monnier
Subject: [elpa] master 68e8ac3: * packages/csv-mode/csv-mode.el (csv-align--cursor-truncated): Fix C-e case
Date: Tue, 22 Oct 2019 11:04:43 -0400 (EDT)

branch: master
commit 68e8ac3632c9918b8266e10d67b30bafe4208a9d
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

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

diff --git a/packages/csv-mode/csv-mode.el b/packages/csv-mode/csv-mode.el
index 73d34bb..d8302b4 100644
--- a/packages/csv-mode/csv-mode.el
+++ b/packages/csv-mode/csv-mode.el
@@ -1464,9 +1464,20 @@ setting works better)."
     (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]