1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
package tcellterm
import (
"time"
"github.com/gdamore/tcell/v2"
)
// EventTerminal is a generic terminal event
type EventTerminal struct {
when time.Time
vt *VT
}
func newEventTerminal(vt *VT) *EventTerminal {
return &EventTerminal{
when: time.Now(),
vt: vt,
}
}
func (ev *EventTerminal) When() time.Time {
return ev.when
}
func (ev *EventTerminal) VT() *VT {
return ev.vt
}
// EventRedraw is emitted when the terminal requires redrawing
type EventRedraw struct {
*EventTerminal
}
// EventClosed is emitted when the terminal exits
type EventClosed struct {
*EventTerminal
}
// EventTitle is emitted when the terminal's title changes
type EventTitle struct {
*EventTerminal
title string
}
func (ev *EventTitle) Title() string {
return ev.title
}
// EventMouseMode is emitted when the terminal mouse mode changes
type EventMouseMode struct {
modes []tcell.MouseFlags
*EventTerminal
}
func (ev *EventMouseMode) Flags() []tcell.MouseFlags {
return ev.modes
}
// EventBell is emitted when BEL is received
type EventBell struct {
*EventTerminal
}
type EventPanic struct {
*EventTerminal
Error error
}
|