emacs-diffs
[Top][All Lists]
Advanced

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

master b2d30fd: A better fix for 'kill-visual-line'


From: Eli Zaretskii
Subject: master b2d30fd: A better fix for 'kill-visual-line'
Date: Thu, 21 Jan 2021 09:22:10 -0500 (EST)

branch: master
commit b2d30fd6303a2461c591f0ace7eb2a43638bba21
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    A better fix for 'kill-visual-line'
    
    * lisp/simple.el (kill-visual-line): Use the 6th element of the
    return value of 'posn-at-point', which provides the coordinates in
    terms or row and column, and is thus more reliable for deciding
    whether we moved to the next screen line.  (Bug#45837)
---
 lisp/simple.el | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 37c0885..2c6e391 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7338,10 +7338,7 @@ even beep.)"
   ;; of the kill before killing.
   (let ((opoint (point))
         (kill-whole-line (and kill-whole-line (bolp)))
-        (orig-y (cdr (nth 2 (posn-at-point))))
-        ;; FIXME: This tolerance should be zero!  It isn't due to a
-        ;; bug in posn-at-point, see bug#45837.
-        (tol (/ (line-pixel-height) 2)))
+        (orig-vlnum (cdr (nth 6 (posn-at-point)))))
     (if arg
        (vertical-motion (prefix-numeric-value arg))
       (end-of-visual-line 1)
@@ -7352,8 +7349,8 @@ even beep.)"
         ;; end-of-visual-line didn't overshoot due to complications
         ;; like display or overlay strings, intangible text, etc.:
         ;; otherwise, we don't want to kill a character that's
-        ;; unrelated to the place where the visual line wrapped.
-        (and (< (abs (- (cdr (nth 2 (posn-at-point))) orig-y)) tol)
+        ;; unrelated to the place where the visual line wraps.
+        (and (= (cdr (nth 6 (posn-at-point))) orig-vlnum)
              ;; Make sure we delete the character where the line wraps
              ;; under visual-line-mode, be it whitespace or a
              ;; character whose category set allows to wrap at it.



reply via email to

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