Skip to content

Commit

Permalink
Improve mouse handling (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamg authored Jul 31, 2021
1 parent d1a7b7d commit 80b4d6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/app/darktile/gui/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion internal/app/darktile/gui/mouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ func (g *GUI) handleMouse() error {
Col: uint16(col),
})
}

ebiten.ScheduleFrame()

} else {
g.mouseDrag = false
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 80b4d6a

Please sign in to comment.