(cursor-sensor-tangible-pos): Prefer shortening the motion
When moving to the middle of an intangible chunk, and either end of the chunk would result in a movement in the right direction, prefer the shorter movement, since it's easier for the users to repeat a movement than to "go back". (see https://lists.gnu.org/archive/html/emacs-devel/2025-12/msg00686.html) * lisp/emacs-lisp/cursor-sensor.el (cursor-sensor-tangible-pos): Refine the choice.
This commit is contained in:
parent
068d94074b
commit
fc117f1d3b
1 changed files with 7 additions and 2 deletions
|
|
@ -109,9 +109,14 @@ By convention, this is a list of symbols where each symbol stands for the
|
|||
;; Goals, from most important to least important:
|
||||
;; - Prefer a tangible position.
|
||||
;; - Preserve the overall direction of the motion.
|
||||
;; - Prefer shortening the motion over lengthening it.
|
||||
(cond
|
||||
((< oldpos curpos) (or nextpos prevpos))
|
||||
((> oldpos curpos) (or prevpos nextpos))
|
||||
((< oldpos curpos)
|
||||
(or (and prevpos (< oldpos prevpos) prevpos) ;Prefer shorter motion.
|
||||
nextpos prevpos))
|
||||
((> oldpos curpos)
|
||||
(or (and nextpos (> oldpos nextpos) nextpos) ;Prefer shorter motion.
|
||||
prevpos nextpos))
|
||||
(t
|
||||
(or (and prevpos nextpos
|
||||
(< (- nextpos curpos) (- curpos prevpos))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue