diff options
| author | citrons <citrons@mondecitronne.com> | 2025-01-29 21:57:36 -0600 |
|---|---|---|
| committer | citrons <citrons@mondecitronne.com> | 2025-01-29 21:57:36 -0600 |
| commit | dcc8a3a4f93eb5b7dcc965e63ad2ea6057a8ee6b (patch) | |
| tree | 02d7fa114a86322d92322533b2ee70874f01b121 /tui/input.go | |
| parent | e3a5cdb759ba98ebcdf43e38efaa9d33aa29f466 (diff) | |
keyboard and mouse handling
Diffstat (limited to 'tui/input.go')
| -rw-r--r-- | tui/input.go | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/tui/input.go b/tui/input.go deleted file mode 100644 index a200e53..0000000 --- a/tui/input.go +++ /dev/null @@ -1,57 +0,0 @@ -package tui - -import ( - "os" - "os/signal" - "golang.org/x/term" - "unicode" - "syscall" - "bufio" -) - -type Event interface {} - -type TextInput rune -type Paste string -type Resize Dims - -var evChan chan Event -func Events() <-chan Event { - if evChan != nil { - return evChan - } - evChan = make(chan Event, 1) - - go func() { - rd := bufio.NewReader(os.Stdin) - for { - r, _, err := rd.ReadRune() - if err != nil { - evChan <- err - return - } - switch { - case r == '\033': - // todo - case unicode.IsControl(r): - default: - evChan <- TextInput(r) - } - } - }() - - sigs := make(chan os.Signal, 1) - signal.Notify(sigs, syscall.SIGWINCH) - go func() { - for _ = range sigs { - w, h, err := term.GetSize(0) - if err == nil { - evChan <- Resize {w, h} - } else { - evChan <- err - } - } - }() - - return evChan -}
\ No newline at end of file |
