From c67d8cde4bbbab4554ed0305521f92cbc1c9bf57 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 7 Nov 2022 07:30:04 -0600 Subject: [PATCH] widget: implement triple click line selection in Editor Fixes: https://todo.sr.ht/~eliasnaur/gio/455 Signed-off-by: Elias Naur --- widget/editor.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/widget/editor.go b/widget/editor.go index 882b2137..26f03fd3 100644 --- a/widget/editor.go +++ b/widget/editor.go @@ -296,11 +296,16 @@ func (e *Editor) processPointer(gtx layout.Context) { } e.dragging = true - // Process a double-click. - if evt.NumClicks == 2 { + // Process multi-clicks. + switch { + case evt.NumClicks == 2: e.moveWord(-1, selectionClear) e.moveWord(1, selectionExtend) e.dragging = false + case evt.NumClicks >= 3: + e.moveStart(selectionClear) + e.moveEnd(selectionExtend) + e.dragging = false } } case pointer.Event: -- 2.45.2