Improve mouse handling (#298)
This commit is contained in:
parent
d1a7b7d6a1
commit
80b4d6ac9c
|
@ -168,6 +168,8 @@ func (g *GUI) handleInput() error {
|
||||||
return g.terminal.WriteToPty([]byte{0x09}) // tab
|
return g.terminal.WriteToPty([]byte{0x09}) // tab
|
||||||
|
|
||||||
case g.keyState.RepeatPressed(ebiten.KeyEscape):
|
case g.keyState.RepeatPressed(ebiten.KeyEscape):
|
||||||
|
g.terminal.GetActiveBuffer().ClearSelection()
|
||||||
|
g.terminal.GetActiveBuffer().ClearHighlight()
|
||||||
return g.terminal.WriteToPty([]byte{0x1b}) // escape
|
return g.terminal.WriteToPty([]byte{0x1b}) // escape
|
||||||
case g.keyState.RepeatPressed(ebiten.KeyBackspace):
|
case g.keyState.RepeatPressed(ebiten.KeyBackspace):
|
||||||
if ebiten.IsKeyPressed(ebiten.KeyAlt) {
|
if ebiten.IsKeyPressed(ebiten.KeyAlt) {
|
||||||
|
|
|
@ -121,6 +121,9 @@ func (g *GUI) handleMouse() error {
|
||||||
Col: uint16(col),
|
Col: uint16(col),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ebiten.ScheduleFrame()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
g.mouseDrag = false
|
g.mouseDrag = false
|
||||||
}
|
}
|
||||||
|
@ -222,7 +225,7 @@ func (g *GUI) handleClick(clickCount, x, y int) (bool, error) {
|
||||||
line := uint64(y / g.fontManager.CharSize().Y)
|
line := uint64(y / g.fontManager.CharSize().Y)
|
||||||
g.terminal.GetActiveBuffer().SelectWordAt(termutil.Position{Col: col, Line: line}, wordMatcher)
|
g.terminal.GetActiveBuffer().SelectWordAt(termutil.Position{Col: col, Line: line}, wordMatcher)
|
||||||
return true, nil
|
return true, nil
|
||||||
case 3: // triple click
|
default: // triple click (or more!)
|
||||||
g.terminal.GetActiveBuffer().ExtendSelectionToEntireLines()
|
g.terminal.GetActiveBuffer().ExtendSelectionToEntireLines()
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue