[Feature Request] Double click drag should select one additional word at a time
Opened this issue · 2 comments
aleichtm commented
Problem Situation:
Currently if you double click on text, hold the second click, and drag, it stays with just the word selected and does not expand the selection. This is a problem because it is different than muscle memory from other programs.
Suggestion:
Implement this behavior so that if you double click and hold the second click and drag, it selects one additional token at a time, as is done on other editors and on web browsers. This is a useful feature because it requires less precision in where you place your mouse.
aleichtm commented
Looks to me like it's specifically in https://github.com/racket/gui/tree/master/gui-lib/mred/private/wxme/pasteboard.rkt
(let ([snip (find-snip x y)])
(if dragable?
(begin
(if snip
(let ([loc (snip->loc snip)])
(set! orig-x (loc-x loc))
(set! orig-y (loc-y loc))
(set! orig-w (loc-w loc))
(set! orig-h (loc-h loc))
(if (not (loc-selected? loc))
(begin
(unless (send event get-shift-down)
(no-selected))
(set-caret-owner #f)
(add-selected snip)
(init-dragging event))
(let ([interval (abs (- (send event get-time-stamp)
last-time))])
(if (and (send event button-down?)
(interval . < . (if s-keymap
(send s-keymap get-double-click-interval)
(get-double-click-threshold))))
(on-double-click snip event)
(let-boxes ([dx sizedxm]
[dy sizedym]
[f? #f])
(set-box! f? (find-dot loc x y dx dy))
(set! sizedxm dx)
(set! sizedym dy)
(when f?
(set! resizing snip))
(init-dragging event)))))
(when (send event button-down?)
(set! last-time (send event get-time-stamp))))
(begin
(unless (send event get-shift-down)
(no-selected))
(set-caret-owner #f)
(when can-rubberband?
(set! rubberband? #t))))
(set! start-x x)
(set! last-x x)
(set! start-y y)
(set! last-y y))
;; not dragable:
(set-caret-owner snip)))
(def/public (on-double-click [snip% snip] [mouse-event% evt])
(when (has-flag? (snip->flags snip) HANDLES-EVENTS)
(no-selected)
(set-caret-owner snip)))