From 80b4d6ac9c96d060c17542f7b9a4acec122ee3a9 Mon Sep 17 00:00:00 2001 From: Liam Galvin Date: Sat, 31 Jul 2021 13:56:39 +0100 Subject: [PATCH] Improve mouse handling (#298) --- internal/app/darktile/gui/input.go | 2 ++ internal/app/darktile/gui/mouse.go | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/app/darktile/gui/input.go b/internal/app/darktile/gui/input.go index aea8d4e..6cd159c 100644 --- a/internal/app/darktile/gui/input.go +++ b/internal/app/darktile/gui/input.go @@ -168,6 +168,8 @@ func (g *GUI) handleInput() error { return g.terminal.WriteToPty([]byte{0x09}) // tab case g.keyState.RepeatPressed(ebiten.KeyEscape): + g.terminal.GetActiveBuffer().ClearSelection() + g.terminal.GetActiveBuffer().ClearHighlight() return g.terminal.WriteToPty([]byte{0x1b}) // escape case g.keyState.RepeatPressed(ebiten.KeyBackspace): if ebiten.IsKeyPressed(ebiten.KeyAlt) { diff --git a/internal/app/darktile/gui/mouse.go b/internal/app/darktile/gui/mouse.go index 1728b5f..8e3699b 100644 --- a/internal/app/darktile/gui/mouse.go +++ b/internal/app/darktile/gui/mouse.go @@ -121,6 +121,9 @@ func (g *GUI) handleMouse() error { Col: uint16(col), }) } + + ebiten.ScheduleFrame() + } else { g.mouseDrag = false } @@ -222,7 +225,7 @@ func (g *GUI) handleClick(clickCount, x, y int) (bool, error) { line := uint64(y / g.fontManager.CharSize().Y) g.terminal.GetActiveBuffer().SelectWordAt(termutil.Position{Col: col, Line: line}, wordMatcher) return true, nil - case 3: // triple click + default: // triple click (or more!) g.terminal.GetActiveBuffer().ExtendSelectionToEntireLines() return true, nil }