Files
zyedidia.micro/cmd/micro/actionhandler.go
2018-08-27 15:53:10 -04:00

39 lines
831 B
Go

package main
import (
"github.com/zyedidia/tcell"
)
type Event interface{}
// RawEvent is simply an escape code
// We allow users to directly bind escape codes
// to get around some of a limitations of terminals
type RawEvent struct {
esc string
}
// KeyEvent is a key event containing a key code,
// some possible modifiers (alt, ctrl, etc...) and
// a rune if it was simply a character press
// Note: to be compatible with tcell events,
// for ctrl keys r=code
type KeyEvent struct {
code tcell.Key
mod tcell.ModMask
r rune
}
// MouseEvent is a mouse event with a mouse button and
// any possible key modifiers
type MouseEvent struct {
btn tcell.ButtonMask
mod tcell.ModMask
}
// An ActionHandler will take a tcell event and execute it
// appropriately
type ActionHandler interface {
HandleEvent(tcell.Event)
}