Skip to content

Commit 4b2c2fa

Browse files
committed
Adjust cursor column when auto-scrolling during rectangle selection
* lisp/mouse.el (mouse-drag-region-rectangle): Move cursor to the correct column during auto-scrolling both when crutches are used and not (bug#38641). Reported by Konrad Podczeck.
1 parent 1a2445c commit 4b2c2fa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lisp/mouse.el

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,11 @@ This must be bound to a button-down mouse event."
20372037
(funcall adjusted-col mouse-col) 'point)
20382038
(unless mouse--rectangle-track-cursor
20392039
(forward-char))
2040-
(rectangle--reset-point-crutches)))))
2040+
(rectangle--reset-point-crutches))))
2041+
(scroll-adjust (lambda ()
2042+
(move-to-column
2043+
(funcall adjusted-col mouse-col))
2044+
(funcall set-col))))
20412045
(if (and (eq window start-window)
20422046
mouse-row
20432047
(<= top mouse-row (1- bottom)))
@@ -2051,11 +2055,11 @@ This must be bound to a button-down mouse event."
20512055
((< mouse-row top)
20522056
(mouse-scroll-subr
20532057
start-window (- mouse-row top) nil start-point
2054-
set-col))
2058+
scroll-adjust))
20552059
((>= mouse-row bottom)
20562060
(mouse-scroll-subr
20572061
start-window (1+ (- mouse-row bottom)) nil start-point
2058-
set-col)))))))
2062+
scroll-adjust)))))))
20592063
(condition-case err
20602064
(progn
20612065
(setq track-mouse t)

0 commit comments

Comments
 (0)