diff options
author | Eli Zaretskii <eliz@gnu.org> | 2021-01-21 16:21:45 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2021-01-21 16:21:45 +0200 |
commit | b2d30fd6303a2461c591f0ace7eb2a43638bba21 (patch) | |
tree | ab3d54068e2dfe24300123f468509c8f95a54eeb /lisp/simple.el | |
parent | 8e7728a5bfaf99efd3fb9ea7dd42dabd11a00b5c (diff) | |
download | emacs-b2d30fd6303a2461c591f0ace7eb2a43638bba21.tar.gz |
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)
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 37c0885dcc5..2c6e3916cd4 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. |