Finish porting clipboard kitten to Go

This commit is contained in:
Kovid Goyal
2022-11-26 15:15:30 +05:30
parent 63a08dc6cc
commit a721ffeb7d
5 changed files with 245 additions and 5 deletions

View File

@@ -20,6 +20,16 @@ type ScreenSize struct {
type IdType uint64
type TimerCallback func(timer_id IdType) error
type EscapeCodeType int
const (
CSI EscapeCodeType = iota
DCS
OSC
APC
SOS
PM
)
type timer struct {
interval time.Duration
@@ -47,6 +57,8 @@ type Loop struct {
pending_writes []*write_msg
on_SIGTSTP func() error
// Send strings to this channel to queue writes in a thread safe way
// Callbacks
// Called when the terminal has been fully setup. Any string returned is sent to
@@ -76,6 +88,9 @@ type Loop struct {
// Called when any input from tty is received
OnReceivedData func(data []byte) error
// Called when an escape code is received that is not handled by any other handler
OnEscapeCode func(EscapeCodeType, []byte) error
// Called when resuming from a SIGTSTP or Ctrl-z
OnResumeFromStop func() error