diff --git a/examples/altscreen-toggle/log.txt b/examples/altscreen-toggle/log.txt new file mode 100644 index 0000000..e69de29 diff --git a/examples/altscreen-toggle/main.go b/examples/altscreen-toggle/main.go index 54a3f09..0e526d1 100644 --- a/examples/altscreen-toggle/main.go +++ b/examples/altscreen-toggle/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "log" "os" tea "github.com/charmbracelet/bubbletea" @@ -66,6 +67,11 @@ func (m model) View() string { } func main() { + f, err := tea.LogToFile("log.txt", "") + if err != nil { + log.Fatal(err) + } + defer f.Close() if _, err := tea.NewProgram(model{}).Run(); err != nil { fmt.Println("Error running program:", err) os.Exit(1) diff --git a/examples/fullscreen/main.go b/examples/fullscreen/main.go index 1c56be0..41e7f9b 100644 --- a/examples/fullscreen/main.go +++ b/examples/fullscreen/main.go @@ -16,7 +16,12 @@ type model int type tickMsg time.Time func main() { - p := tea.NewProgram(model(5), tea.WithAltScreen()) + f, err := tea.LogToFile("log.txt", "") + if err != nil { + log.Fatal(err) + } + defer f.Close() + p := tea.NewProgram(model(50), tea.WithAltScreen(), tea.WithMouseAllMotion()) if _, err := p.Run(); err != nil { log.Fatal(err) } diff --git a/examples/glamour/main.go b/examples/glamour/main.go index 976ee3b..36307fb 100644 --- a/examples/glamour/main.go +++ b/examples/glamour/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "log" "os" "github.com/charmbracelet/bubbles/viewport" @@ -91,6 +92,12 @@ func (e example) Init() tea.Cmd { func (e example) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { + case tea.WindowSizeMsg: + e.viewport.Width = msg.Width + e.viewport.Height = msg.Height - 2 + var cmd tea.Cmd + e.viewport, cmd = e.viewport.Update(msg) + return e, cmd case tea.KeyMsg: switch msg.String() { case "q", "ctrl+c", "esc": @@ -114,13 +121,18 @@ func (e example) helpView() string { } func main() { + f, err := tea.LogToFile("log.txt", "") + if err != nil { + log.Fatal(err) + } + defer f.Close() model, err := newExample() if err != nil { fmt.Println("Could not initialize Bubble Tea model:", err) os.Exit(1) } - if _, err := tea.NewProgram(model).Run(); err != nil { + if _, err := tea.NewProgram(model, tea.WithAltScreen()).Run(); err != nil { fmt.Println("Bummer, there's been an error:", err) os.Exit(1) } diff --git a/examples/go.mod b/examples/go.mod index ab5d792..11986ff 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -25,6 +25,7 @@ require ( github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect github.com/dlclark/regexp2 v1.4.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect + github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/gorilla/css v1.0.0 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect diff --git a/examples/go.sum b/examples/go.sum index 725fddf..3b3e12e 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -30,6 +30,8 @@ github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= github.com/fogleman/ease v0.0.0-20170301025033-8da417bf1776 h1:VRIbnDWRmAh5yBdz+J6yFMF5vso1It6vn+WmM/5l7MA= github.com/fogleman/ease v0.0.0-20170301025033-8da417bf1776/go.mod h1:9wvnDu3YOfxzWM9Cst40msBF1C2UdQgDv962oTxSuMs= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= @@ -95,6 +97,7 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/examples/log.txt b/examples/log.txt new file mode 100644 index 0000000..65374a1 --- /dev/null +++ b/examples/log.txt @@ -0,0 +1,837 @@ +2023/09/14 16:38:56 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:38:56 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 16:39:47 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:39:47 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 16:39:49 Read 1 events: +2023/09/14 16:40:16 Read 1 events: +2023/09/14 16:40:17 Read 1 events: +2023/09/14 16:40:19 Read 1 events: +2023/09/14 16:40:21 Read 1 events: +2023/09/14 16:40:48 Read 1 events: +2023/09/14 16:40:51 Read 1 events: +2023/09/14 16:42:46 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:42:46 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 16:42:47 Read 1 events: +2023/09/14 16:43:03 Read 1 events: +2023/09/14 16:43:18 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:43:18 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 16:43:21 Read 1 events: +2023/09/14 16:43:21 FocusEvent[true] +2023/09/14 16:43:22 Read 1 events: +2023/09/14 16:43:22 KeyEvent['a', up, KeyCode: 65, ScanCode: 30] +2023/09/14 16:43:23 Read 1 events: +2023/09/14 16:43:23 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:43:23 Read 1 events: +2023/09/14 16:43:23 KeyEvent['c', up, KeyCode: 67, ScanCode: 46] +2023/09/14 16:43:24 Read 1 events: +2023/09/14 16:43:24 KeyEvent['b', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:44:47 Read 1 events: +2023/09/14 16:44:47 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 16:45:47 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:45:47 Setting mode to: ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 16:45:47 Read 1 events: +2023/09/14 16:45:47 KeyEvent['\x00', down, Alt, KeyCode: 18, ScanCode: 56] +2023/09/14 16:46:09 Read 1 events: +2023/09/14 16:46:09 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 16:49:33 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:49:33 Setting mode to: ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 16:49:37 Read 1 events: +2023/09/14 16:49:37 KeyEvent['c', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:49:37 Read 1 events: +2023/09/14 16:49:37 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:49:37 Read 1 events: +2023/09/14 16:49:37 KeyEvent['f', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:49:37 Read 1 events: +2023/09/14 16:49:37 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:49:38 Read 1 events: +2023/09/14 16:49:38 KeyEvent['f', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:49:38 Read 1 events: +2023/09/14 16:49:38 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:49:40 Read 1 events: +2023/09/14 16:49:40 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:16 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:51:16 Setting mode to: ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 16:51:19 Read 1 events: +2023/09/14 16:51:19 FocusEvent[false] +2023/09/14 16:51:25 Read 1 events: +2023/09/14 16:51:25 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:51:27 Read 1 events: +2023/09/14 16:51:27 KeyEvent['a', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:27 Read 1 events: +2023/09/14 16:51:27 KeyEvent['s', up, KeyCode: 83, ScanCode: 31] +2023/09/14 16:51:27 Read 1 events: +2023/09/14 16:51:27 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:27 Read 1 events: +2023/09/14 16:51:27 KeyEvent['l', up, KeyCode: 76, ScanCode: 38] +2023/09/14 16:51:29 Read 1 events: +2023/09/14 16:51:29 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:32 Read 1 events: +2023/09/14 16:51:32 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:51:35 Read 1 events: +2023/09/14 16:51:35 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:37 Read 1 events: +2023/09/14 16:51:37 KeyEvent['b', up, KeyCode: 66, ScanCode: 48] +2023/09/14 16:51:37 Read 1 events: +2023/09/14 16:51:37 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:38 Read 1 events: +2023/09/14 16:51:38 KeyEvent['g', up, KeyCode: 71, ScanCode: 34] +2023/09/14 16:51:38 Read 1 events: +2023/09/14 16:51:38 KeyEvent['k', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:38 Read 1 events: +2023/09/14 16:51:38 KeyEvent['k', up, KeyCode: 75, ScanCode: 37] +2023/09/14 16:51:47 Read 1 events: +2023/09/14 16:51:47 KeyEvent['s', up, KeyCode: 83, ScanCode: 31] +2023/09/14 16:51:47 Read 1 events: +2023/09/14 16:51:47 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:47 Read 1 events: +2023/09/14 16:51:47 KeyEvent['f', up, KeyCode: 70, ScanCode: 33] +2023/09/14 16:51:47 Read 1 events: +2023/09/14 16:51:47 KeyEvent['g', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:48 Read 1 events: +2023/09/14 16:51:48 KeyEvent['s', up, KeyCode: 83, ScanCode: 31] +2023/09/14 16:51:48 Read 1 events: +2023/09/14 16:51:48 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:48 Read 1 events: +2023/09/14 16:51:48 KeyEvent['f', up, KeyCode: 70, ScanCode: 33] +2023/09/14 16:51:48 Read 1 events: +2023/09/14 16:51:48 KeyEvent['g', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:51:50 Read 1 events: +2023/09/14 16:51:50 KeyEvent['v', up, KeyCode: 86, ScanCode: 47] +2023/09/14 16:51:51 Read 1 events: +2023/09/14 16:51:51 KeyEvent['\x00', down, Shift, KeyCode: 16, ScanCode: 42] +2023/09/14 16:51:51 Read 1 events: +2023/09/14 16:51:51 KeyEvent['F', up, Shift, KeyCode: 70, ScanCode: 33] +2023/09/14 16:51:52 Read 1 events: +2023/09/14 16:51:52 KeyEvent['\x00', up, KeyCode: 16, ScanCode: 42] +2023/09/14 16:52:00 Read 1 events: +2023/09/14 16:52:00 KeyEvent['\x18', up, CTRL, KeyCode: 88, ScanCode: 45] +2023/09/14 16:52:01 Read 1 events: +2023/09/14 16:52:01 KeyEvent['\x00', up, KeyCode: 17, ScanCode: 29] +2023/09/14 16:52:14 Read 1 events: +2023/09/14 16:52:14 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 16:53:55 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:53:55 Setting mode to: ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 16:53:57 Read 1 events: +2023/09/14 16:53:57 KeyEvent['a', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:53:58 Read 1 events: +2023/09/14 16:53:58 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:54:09 Read 1 events: +2023/09/14 16:54:09 WindowBufferSizeEvent[(88, 29)] +2023/09/14 16:54:13 Read 1 events: +2023/09/14 16:54:13 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 16:54:13 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:54:23 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:54:23 Setting mode to: ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 16:54:23 Read 1 events: +2023/09/14 16:54:23 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:54:24 Read 1 events: +2023/09/14 16:54:24 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 16:54:24 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:54:26 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:54:26 Setting mode to: ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 16:54:28 Read 1 events: +2023/09/14 16:54:28 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:54:30 Read 1 events: +2023/09/14 16:54:30 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 16:54:30 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:56:17 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:56:17 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 16:56:22 Read 1 events: +2023/09/14 16:56:22 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:56:23 Read 1 events: +2023/09/14 16:56:23 KeyEvent['v', up, KeyCode: 86, ScanCode: 47] +2023/09/14 16:56:24 Read 1 events: +2023/09/14 16:56:24 KeyEvent['c', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:56:25 Read 1 events: +2023/09/14 16:56:25 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 16:56:25 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:56:27 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:56:27 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 16:56:28 Read 1 events: +2023/09/14 16:56:28 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:56:29 Read 1 events: +2023/09/14 16:56:29 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:56:32 Read 1 events: +2023/09/14 16:56:32 WindowBufferSizeEvent[(93, 33)] +2023/09/14 16:56:41 Read 1 events: +2023/09/14 16:56:41 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:56:43 Read 1 events: +2023/09/14 16:56:43 WindowBufferSizeEvent[(94, 31)] +2023/09/14 16:56:58 Read 1 events: +2023/09/14 16:56:58 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:57:02 Read 1 events: +2023/09/14 16:57:02 WindowBufferSizeEvent[(73, 25)] +2023/09/14 16:57:06 Read 1 events: +2023/09/14 16:57:06 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:57:09 Read 1 events: +2023/09/14 16:57:09 WindowBufferSizeEvent[(78, 28)] +2023/09/14 16:57:13 Read 1 events: +2023/09/14 16:57:13 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 16:57:13 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:57:29 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:57:29 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 16:57:32 Read 1 events: +2023/09/14 16:57:32 WindowBufferSizeEvent[(81, 30)] +2023/09/14 16:57:43 Read 1 events: +2023/09/14 16:57:43 KeyEvent['f', up, KeyCode: 70, ScanCode: 33] +2023/09/14 16:57:45 Read 1 events: +2023/09/14 16:57:45 WindowBufferSizeEvent[(84, 31)] +2023/09/14 16:57:46 Read 1 events: +2023/09/14 16:57:46 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:57:47 Read 1 events: +2023/09/14 16:57:47 WindowBufferSizeEvent[(86, 34)] +2023/09/14 16:57:50 Read 1 events: +2023/09/14 16:57:50 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:57:52 Read 1 events: +2023/09/14 16:57:52 WindowBufferSizeEvent[(75, 25)] +2023/09/14 16:57:53 Read 1 events: +2023/09/14 16:57:53 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:57:55 Read 1 events: +2023/09/14 16:57:55 WindowBufferSizeEvent[(69, 21)] +2023/09/14 16:57:56 Read 1 events: +2023/09/14 16:57:56 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:57:57 Read 1 events: +2023/09/14 16:57:57 FocusEvent[false] +2023/09/14 16:58:17 Read 1 events: +2023/09/14 16:58:17 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:58:19 Read 1 events: +2023/09/14 16:58:19 FocusEvent[false] +2023/09/14 16:58:24 Read 1 events: +2023/09/14 16:58:24 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 16:58:24 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:59:03 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:59:03 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 16:59:05 Read 1 events: +2023/09/14 16:59:05 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:59:07 Read 1 events: +2023/09/14 16:59:07 KeyEvent['f', up, KeyCode: 70, ScanCode: 33] +2023/09/14 16:59:07 Read 1 events: +2023/09/14 16:59:07 KeyEvent['z', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:59:12 Read 1 events: +2023/09/14 16:59:12 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:59:14 Read 1 events: +2023/09/14 16:59:14 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:59:16 Read 1 events: +2023/09/14 16:59:16 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:59:18 Read 1 events: +2023/09/14 16:59:18 KeyEvent['\x00', down, CTRL, KeyCode: 17, ScanCode: 29] +2023/09/14 16:59:18 Read 1 events: +2023/09/14 16:59:18 KeyEvent['\x03', up, CTRL, KeyCode: 67, ScanCode: 46] +2023/09/14 16:59:18 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:59:31 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 16:59:31 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 16:59:32 Read 1 events: +2023/09/14 16:59:32 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:59:36 Read 1 events: +2023/09/14 16:59:36 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:59:37 Read 1 events: +2023/09/14 16:59:37 WindowBufferSizeEvent[(66, 23)] +2023/09/14 16:59:39 Read 1 events: +2023/09/14 16:59:39 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:59:40 Read 1 events: +2023/09/14 16:59:40 WindowBufferSizeEvent[(71, 21)] +2023/09/14 16:59:41 Read 1 events: +2023/09/14 16:59:41 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:59:42 Read 1 events: +2023/09/14 16:59:42 WindowBufferSizeEvent[(63, 21)] +2023/09/14 16:59:43 Read 1 events: +2023/09/14 16:59:43 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:59:45 Read 1 events: +2023/09/14 16:59:45 WindowBufferSizeEvent[(53, 21)] +2023/09/14 16:59:49 Read 1 events: +2023/09/14 16:59:49 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 16:59:52 Read 1 events: +2023/09/14 16:59:52 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 16:59:53 Read 1 events: +2023/09/14 16:59:53 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 16:59:53 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:04:59 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:04:59 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:05:02 Read 1 events: +2023/09/14 17:05:02 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:05:04 Read 1 events: +2023/09/14 17:05:04 KeyEvent['c', up, KeyCode: 67, ScanCode: 46] +2023/09/14 17:05:04 Read 2 events: +2023/09/14 17:05:04 KeyEvent['z', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:05:04 KeyEvent['z', up, KeyCode: 90, ScanCode: 44] +2023/09/14 17:05:06 Read 1 events: +2023/09/14 17:05:06 KeyEvent['c', up, KeyCode: 67, ScanCode: 46] +2023/09/14 17:05:07 Read 2 events: +2023/09/14 17:05:07 KeyEvent['v', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:05:07 KeyEvent['v', up, KeyCode: 86, ScanCode: 47] +2023/09/14 17:05:08 Read 1 events: +2023/09/14 17:05:08 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:05:08 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:05:11 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:05:11 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:05:13 Read 1 events: +2023/09/14 17:05:13 WindowBufferSizeEvent[(68, 21)] +2023/09/14 17:05:22 Read 1 events: +2023/09/14 17:05:22 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:05:24 Read 1 events: +2023/09/14 17:05:24 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:05:24 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:15:42 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:15:42 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:15:44 read input events: size of input record buffer cannot be zero +2023/09/14 17:15:57 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:16:32 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:16:32 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:16:35 Read 1 events: +2023/09/14 17:16:35 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:16:36 Read 1 events: +2023/09/14 17:16:36 KeyEvent['v', up, KeyCode: 86, ScanCode: 47] +2023/09/14 17:16:38 Read 1 events: +2023/09/14 17:16:38 KeyEvent['c', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:16:40 Read 1 events: +2023/09/14 17:16:40 KeyEvent['x', up, KeyCode: 88, ScanCode: 45] +2023/09/14 17:16:41 Read 1 events: +2023/09/14 17:16:41 KeyEvent['z', up, KeyCode: 90, ScanCode: 44] +2023/09/14 17:16:44 Read 1 events: +2023/09/14 17:16:44 WindowBufferSizeEvent[(58, 17)] +2023/09/14 17:17:02 Read 1 events: +2023/09/14 17:17:02 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:17:04 Read 1 events: +2023/09/14 17:17:04 FocusEvent[true] +2023/09/14 17:17:06 Read 1 events: +2023/09/14 17:17:06 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:17:09 Read 1 events: +2023/09/14 17:17:09 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:17:10 Read 1 events: +2023/09/14 17:17:10 FocusEvent[true] +2023/09/14 17:17:27 Read 1 events: +2023/09/14 17:17:27 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:17:27 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:18:22 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:18:22 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:18:26 Read 1 events: +2023/09/14 17:18:26 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:18:26 Read 1 events: +2023/09/14 17:18:26 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:18:26 Read 2 events: +2023/09/14 17:18:26 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:18:26 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:18:27 Read 1 events: +2023/09/14 17:18:27 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:18:31 Read 1 events: +2023/09/14 17:18:31 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:18:32 Read 1 events: +2023/09/14 17:18:32 FocusEvent[true] +2023/09/14 17:18:38 Read 1 events: +2023/09/14 17:18:38 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:18:41 Read 1 events: +2023/09/14 17:18:41 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:18:55 Read 1 events: +2023/09/14 17:18:55 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:18:56 Read 2 events: +2023/09/14 17:18:56 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:18:56 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:18:58 Read 1 events: +2023/09/14 17:18:58 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:18:58 Read 2 events: +2023/09/14 17:18:58 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:18:58 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:19:00 Read 1 events: +2023/09/14 17:19:00 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:19:00 Read 2 events: +2023/09/14 17:19:00 KeyEvent['f', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:19:00 KeyEvent['f', up, KeyCode: 70, ScanCode: 33] +2023/09/14 17:19:00 Read 1 events: +2023/09/14 17:19:00 KeyEvent['a', up, KeyCode: 65, ScanCode: 30] +2023/09/14 17:19:00 Read 1 events: +2023/09/14 17:19:00 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:19:01 Read 1 events: +2023/09/14 17:19:01 KeyEvent['f', up, KeyCode: 70, ScanCode: 33] +2023/09/14 17:19:01 Read 2 events: +2023/09/14 17:19:01 KeyEvent['s', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:19:01 KeyEvent['s', up, KeyCode: 83, ScanCode: 31] +2023/09/14 17:19:01 Read 1 events: +2023/09/14 17:19:01 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:19:02 Read 1 events: +2023/09/14 17:19:02 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:19:03 Read 1 events: +2023/09/14 17:19:03 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:19:05 Read 1 events: +2023/09/14 17:19:05 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:19:05 Read 1 events: +2023/09/14 17:19:05 KeyEvent['f', up, KeyCode: 70, ScanCode: 33] +2023/09/14 17:19:05 Read 2 events: +2023/09/14 17:19:05 KeyEvent['x', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:19:05 KeyEvent['x', up, KeyCode: 88, ScanCode: 45] +2023/09/14 17:19:06 Read 1 events: +2023/09/14 17:19:06 KeyEvent['v', up, KeyCode: 86, ScanCode: 47] +2023/09/14 17:19:06 Read 2 events: +2023/09/14 17:19:06 KeyEvent['c', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:19:06 KeyEvent['c', up, KeyCode: 67, ScanCode: 46] +2023/09/14 17:19:18 Read 1 events: +2023/09/14 17:19:18 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:19:21 Read 2 events: +2023/09/14 17:19:21 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:19:21 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:19:21 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:19:29 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:19:29 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:19:30 Read 1 events: +2023/09/14 17:19:30 KeyEvent['\x04', up, CTRL, KeyCode: 68, ScanCode: 32] +2023/09/14 17:19:31 Read 2 events: +2023/09/14 17:19:31 KeyEvent['\x04', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:19:31 KeyEvent['\x04', up, CTRL, KeyCode: 68, ScanCode: 32] +2023/09/14 17:19:33 Read 1 events: +2023/09/14 17:19:33 KeyEvent['\x04', up, CTRL, KeyCode: 68, ScanCode: 32] +2023/09/14 17:19:34 Read 1 events: +2023/09/14 17:19:34 KeyEvent['\x00', up, KeyCode: 17, ScanCode: 29] +2023/09/14 17:19:35 Read 1 events: +2023/09/14 17:19:35 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:19:36 Read 1 events: +2023/09/14 17:19:36 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:19:36 Read 1 events: +2023/09/14 17:19:36 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:19:36 Read 1 events: +2023/09/14 17:19:36 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:19:37 Read 1 events: +2023/09/14 17:19:37 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:19:37 Read 1 events: +2023/09/14 17:19:37 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:19:37 Read 1 events: +2023/09/14 17:19:37 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:19:37 Read 1 events: +2023/09/14 17:19:37 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:19:37 Read 1 events: +2023/09/14 17:19:37 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:19:37 Read 1 events: +2023/09/14 17:19:37 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:19:38 Read 1 events: +2023/09/14 17:19:38 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:19:38 Read 1 events: +2023/09/14 17:19:38 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:19:38 Read 1 events: +2023/09/14 17:19:38 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:19:51 Read 1 events: +2023/09/14 17:19:51 KeyEvent['\x03', up, CTRL, KeyCode: 67, ScanCode: 46] +2023/09/14 17:19:52 Read 2 events: +2023/09/14 17:19:52 KeyEvent['\x03', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:19:52 KeyEvent['\x03', up, CTRL, KeyCode: 67, ScanCode: 46] +2023/09/14 17:19:52 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:19:55 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:19:55 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:20:00 Read 1 events: +2023/09/14 17:20:00 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:20:01 Read 1 events: +2023/09/14 17:20:01 WindowBufferSizeEvent[(84, 36)] +2023/09/14 17:20:05 Read 1 events: +2023/09/14 17:20:05 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:20:08 Read 1 events: +2023/09/14 17:20:08 WindowBufferSizeEvent[(84, 31)] +2023/09/14 17:20:10 Read 1 events: +2023/09/14 17:20:10 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:20:11 Read 1 events: +2023/09/14 17:20:11 WindowBufferSizeEvent[(83, 32)] +2023/09/14 17:20:14 Read 1 events: +2023/09/14 17:20:14 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:20:16 Read 2 events: +2023/09/14 17:20:16 KeyEvent['k', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:20:16 KeyEvent['k', up, KeyCode: 75, ScanCode: 37] +2023/09/14 17:20:16 Read 1 events: +2023/09/14 17:20:16 KeyEvent['k', up, KeyCode: 75, ScanCode: 37] +2023/09/14 17:20:17 Read 1 events: +2023/09/14 17:20:17 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:20:17 Read 1 events: +2023/09/14 17:20:17 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:20:20 Read 1 events: +2023/09/14 17:20:20 WindowBufferSizeEvent[(69, 32)] +2023/09/14 17:20:22 Read 1 events: +2023/09/14 17:20:22 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:20:22 Read 1 events: +2023/09/14 17:20:22 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:20:23 Read 1 events: +2023/09/14 17:20:23 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:20:25 Read 2 events: +2023/09/14 17:20:25 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:20:25 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:20:25 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:22:59 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:22:59 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:23:16 Read 1 events: +2023/09/14 17:23:16 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:23:16 Read 2 events: +2023/09/14 17:23:16 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:23:16 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:23:16 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:23:18 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:23:18 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:23:22 Read 1 events: +2023/09/14 17:23:22 FocusEvent[true] +2023/09/14 17:23:25 Read 1 events: +2023/09/14 17:23:25 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:23:26 Read 2 events: +2023/09/14 17:23:26 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:23:26 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:23:26 Read 1 events: +2023/09/14 17:23:26 KeyEvent['u', up, KeyCode: 85, ScanCode: 22] +2023/09/14 17:23:29 Read 1 events: +2023/09/14 17:23:29 FocusEvent[true] +2023/09/14 17:23:34 Read 1 events: +2023/09/14 17:23:34 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:23:37 Read 1 events: +2023/09/14 17:23:37 WindowBufferSizeEvent[(78, 35)] +2023/09/14 17:23:41 Read 1 events: +2023/09/14 17:23:41 KeyEvent['u', up, KeyCode: 85, ScanCode: 22] +2023/09/14 17:23:46 Read 1 events: +2023/09/14 17:23:46 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:23:48 Read 1 events: +2023/09/14 17:23:48 WindowBufferSizeEvent[(78, 30)] +2023/09/14 17:23:49 Read 1 events: +2023/09/14 17:23:49 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:23:50 Read 2 events: +2023/09/14 17:23:50 KeyEvent['u', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:23:50 KeyEvent['u', up, KeyCode: 85, ScanCode: 22] +2023/09/14 17:23:50 Read 1 events: +2023/09/14 17:23:50 KeyEvent['u', up, KeyCode: 85, ScanCode: 22] +2023/09/14 17:23:50 Read 2 events: +2023/09/14 17:23:50 KeyEvent['u', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:23:50 KeyEvent['u', up, KeyCode: 85, ScanCode: 22] +2023/09/14 17:23:52 Read 1 events: +2023/09/14 17:23:52 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:23:57 Read 1 events: +2023/09/14 17:23:57 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:23:59 Read 1 events: +2023/09/14 17:23:59 FocusEvent[true] +2023/09/14 17:24:03 Read 1 events: +2023/09/14 17:24:03 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:24:05 Read 1 events: +2023/09/14 17:24:05 WindowBufferSizeEvent[(78, 32)] +2023/09/14 17:24:36 Read 1 events: +2023/09/14 17:24:36 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:24:36 Read 2 events: +2023/09/14 17:24:36 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:24:36 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:24:36 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:24:38 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:24:38 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:24:40 Read 1 events: +2023/09/14 17:24:40 KeyEvent['f', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:24:41 Read 1 events: +2023/09/14 17:24:41 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:24:41 Read 2 events: +2023/09/14 17:24:41 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:24:41 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:24:43 Read 1 events: +2023/09/14 17:24:43 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:24:44 Read 1 events: +2023/09/14 17:24:44 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:24:45 Read 2 events: +2023/09/14 17:24:45 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:24:45 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:24:46 Read 1 events: +2023/09/14 17:24:46 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:24:47 Read 1 events: +2023/09/14 17:24:47 FocusEvent[false] +2023/09/14 17:24:47 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:24:54 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:24:54 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:24:55 Read 1 events: +2023/09/14 17:24:55 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:24:57 Read 1 events: +2023/09/14 17:24:57 KeyEvent['u', up, KeyCode: 85, ScanCode: 22] +2023/09/14 17:24:57 Read 1 events: +2023/09/14 17:24:57 KeyEvent['u', up, KeyCode: 85, ScanCode: 22] +2023/09/14 17:24:58 Read 1 events: +2023/09/14 17:24:58 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:24:58 Read 1 events: +2023/09/14 17:24:58 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:24:59 Read 2 events: +2023/09/14 17:24:59 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:24:59 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:00 Read 1 events: +2023/09/14 17:25:00 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:01 Read 2 events: +2023/09/14 17:25:01 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:25:01 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:02 Read 1 events: +2023/09/14 17:25:02 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:02 Read 2 events: +2023/09/14 17:25:02 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:25:02 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:03 Read 1 events: +2023/09/14 17:25:03 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:03 Read 2 events: +2023/09/14 17:25:03 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:25:03 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:03 Read 1 events: +2023/09/14 17:25:03 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:04 Read 2 events: +2023/09/14 17:25:04 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:25:04 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:04 Read 1 events: +2023/09/14 17:25:04 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:04 Read 2 events: +2023/09/14 17:25:04 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:25:04 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:04 Read 1 events: +2023/09/14 17:25:04 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:05 Read 2 events: +2023/09/14 17:25:05 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:25:05 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:05 Read 1 events: +2023/09/14 17:25:05 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:06 Read 2 events: +2023/09/14 17:25:06 KeyEvent['k', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:25:06 KeyEvent['k', up, KeyCode: 75, ScanCode: 37] +2023/09/14 17:25:06 Read 1 events: +2023/09/14 17:25:06 KeyEvent['k', up, KeyCode: 75, ScanCode: 37] +2023/09/14 17:25:07 Read 2 events: +2023/09/14 17:25:07 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:25:07 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:07 Read 1 events: +2023/09/14 17:25:07 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:25:09 Read 1 events: +2023/09/14 17:25:09 WindowBufferSizeEvent[(78, 33)] +2023/09/14 17:25:11 Read 1 events: +2023/09/14 17:25:11 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:25:12 Read 1 events: +2023/09/14 17:25:12 FocusEvent[true] +2023/09/14 17:25:16 Read 1 events: +2023/09/14 17:25:16 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:25:17 Read 1 events: +2023/09/14 17:25:17 WindowBufferSizeEvent[(78, 39)] +2023/09/14 17:25:19 Read 1 events: +2023/09/14 17:25:19 KeyEvent['u', up, KeyCode: 85, ScanCode: 22] +2023/09/14 17:25:19 Read 1 events: +2023/09/14 17:25:19 KeyEvent['u', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:25:20 Read 1 events: +2023/09/14 17:25:20 KeyEvent['u', up, KeyCode: 85, ScanCode: 22] +2023/09/14 17:25:25 Read 1 events: +2023/09/14 17:25:25 FocusEvent[false] +2023/09/14 17:33:17 Read 1 events: +2023/09/14 17:33:17 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:33:19 Read 2 events: +2023/09/14 17:33:19 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:33:19 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:33:19 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:33:22 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:33:22 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:33:22 Read 1 events: +2023/09/14 17:33:22 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:33:23 Read 1 events: +2023/09/14 17:33:23 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:33:23 Read 1 events: +2023/09/14 17:33:23 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:33:26 Read 1 events: +2023/09/14 17:33:26 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:33:31 Read 1 events: +2023/09/14 17:33:31 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:33:36 Read 1 events: +2023/09/14 17:33:36 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:33:42 Read 1 events: +2023/09/14 17:33:42 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:33:48 Read 1 events: +2023/09/14 17:33:48 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:33:49 Read 2 events: +2023/09/14 17:33:49 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:33:49 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:33:49 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:33:52 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:33:52 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:33:55 Read 1 events: +2023/09/14 17:33:55 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:33:58 Read 1 events: +2023/09/14 17:33:58 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:34:04 Read 1 events: +2023/09/14 17:34:04 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:34:08 Read 1 events: +2023/09/14 17:34:08 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:34:09 Read 2 events: +2023/09/14 17:34:09 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:34:09 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:34:09 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:34:27 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:34:27 Setting mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE|ENABLE_WINDOW_INPUT +2023/09/14 17:34:28 Read 1 events: +2023/09/14 17:34:28 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:34:30 Read 1 events: +2023/09/14 17:34:30 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:34:31 Read 2 events: +2023/09/14 17:34:31 KeyEvent['j', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:34:31 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:34:32 Read 1 events: +2023/09/14 17:34:32 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:34:34 Read 1 events: +2023/09/14 17:34:34 WindowBufferSizeEvent[(80, 37)] +2023/09/14 17:34:40 Read 1 events: +2023/09/14 17:34:40 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:34:43 Read 1 events: +2023/09/14 17:34:43 WindowBufferSizeEvent[(80, 33)] +2023/09/14 17:34:53 Read 1 events: +2023/09/14 17:34:53 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:34:56 Read 1 events: +2023/09/14 17:34:56 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:35:02 Read 1 events: +2023/09/14 17:35:02 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:35:06 Read 1 events: +2023/09/14 17:35:06 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:35:10 Read 1 events: +2023/09/14 17:35:10 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:35:17 Read 1 events: +2023/09/14 17:35:17 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:35:21 Read 1 events: +2023/09/14 17:35:21 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:35:33 Read 1 events: +2023/09/14 17:35:33 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:35:36 Read 1 events: +2023/09/14 17:35:36 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:35:39 Read 1 events: +2023/09/14 17:35:39 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:35:43 Read 1 events: +2023/09/14 17:35:43 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:37:03 Read 1 events: +2023/09/14 17:37:03 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:37:04 Read 2 events: +2023/09/14 17:37:04 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:37:04 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:37:04 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:37:07 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:37:07 Setting mode to: ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 17:37:08 Read 1 events: +2023/09/14 17:37:08 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:37:09 Read 1 events: +2023/09/14 17:37:09 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:37:10 Read 1 events: +2023/09/14 17:37:10 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:37:21 Read 1 events: +2023/09/14 17:37:21 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:37:26 Read 1 events: +2023/09/14 17:37:26 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:37:33 Read 1 events: +2023/09/14 17:37:33 KeyEvent['j', up, KeyCode: 74, ScanCode: 36] +2023/09/14 17:37:34 Read 1 events: +2023/09/14 17:37:34 WindowBufferSizeEvent[(87, 34)] +2023/09/14 17:37:46 Read 1 events: +2023/09/14 17:37:46 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:37:50 Read 1 events: +2023/09/14 17:37:50 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:37:53 Read 1 events: +2023/09/14 17:37:53 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:37:58 Read 1 events: +2023/09/14 17:37:58 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:39:26 Read 1 events: +2023/09/14 17:39:26 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:39:26 Read 2 events: +2023/09/14 17:39:26 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:39:26 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:39:26 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:39:28 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:39:28 Setting mode to: ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 17:39:29 Read 3 events: +2023/09/14 17:39:29 KeyEvent['\x1b', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:39:29 KeyEvent['[', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:39:29 KeyEvent['B', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:39:29 Read 1 events: +2023/09/14 17:39:29 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:39:29 Read 1 events: +2023/09/14 17:39:29 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:39:29 Read 1 events: +2023/09/14 17:39:29 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:39:31 Read 1 events: +2023/09/14 17:39:31 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:39:31 Read 1 events: +2023/09/14 17:39:31 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:39:31 Read 1 events: +2023/09/14 17:39:31 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:39:32 Read 1 events: +2023/09/14 17:39:32 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:39:36 Read 1 events: +2023/09/14 17:39:36 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:39:42 Read 1 events: +2023/09/14 17:39:42 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:40:10 Read 1 events: +2023/09/14 17:40:10 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:40:12 Read 3 events: +2023/09/14 17:40:12 KeyEvent['\x1b', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:40:12 KeyEvent['[', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:40:12 KeyEvent['B', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:40:12 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:40:14 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:40:14 Setting mode to: ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 17:40:15 Read 1 events: +2023/09/14 17:40:15 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:40:15 Read 1 events: +2023/09/14 17:40:15 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:40:16 Read 1 events: +2023/09/14 17:40:16 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:40:16 Read 1 events: +2023/09/14 17:40:16 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:40:17 Read 1 events: +2023/09/14 17:40:17 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:40:17 Read 1 events: +2023/09/14 17:40:17 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:40:17 Read 1 events: +2023/09/14 17:40:17 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:40:17 Read 1 events: +2023/09/14 17:40:17 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:40:21 Read 1 events: +2023/09/14 17:40:21 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:40:29 Read 1 events: +2023/09/14 17:40:29 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:40:30 Read 1 events: +2023/09/14 17:40:30 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:40:35 Read 1 events: +2023/09/14 17:40:35 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:59:09 Read 1 events: +2023/09/14 17:59:09 KeyEvent['\x03', up, CTRL, KeyCode: 67, ScanCode: 46] +2023/09/14 17:59:09 Read 1 events: +2023/09/14 17:59:09 KeyEvent['\x00', up, KeyCode: 17, ScanCode: 29] +2023/09/14 17:59:09 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:59:11 Input mode: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE +2023/09/14 17:59:11 Setting mode to: ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT +2023/09/14 17:59:12 Read 3 events: +2023/09/14 17:59:12 KeyEvent['\x1b', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:59:12 KeyEvent['[', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:59:12 KeyEvent['B', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:59:13 Read 1 events: +2023/09/14 17:59:13 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:59:15 Read 1 events: +2023/09/14 17:59:15 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:59:19 Read 1 events: +2023/09/14 17:59:19 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:59:21 Read 1 events: +2023/09/14 17:59:21 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:59:21 Read 1 events: +2023/09/14 17:59:21 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:59:21 Read 1 events: +2023/09/14 17:59:21 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:59:22 Read 1 events: +2023/09/14 17:59:22 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:59:22 Read 1 events: +2023/09/14 17:59:22 KeyEvent['\x00', up, Enhanced, KeyCode: 40, ScanCode: 80] +2023/09/14 17:59:22 Read 1 events: +2023/09/14 17:59:22 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:59:22 Read 1 events: +2023/09/14 17:59:22 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:59:22 Read 1 events: +2023/09/14 17:59:22 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:59:23 Read 1 events: +2023/09/14 17:59:23 KeyEvent['\x00', up, Enhanced, KeyCode: 38, ScanCode: 72] +2023/09/14 17:59:28 Read 1 events: +2023/09/14 17:59:28 WindowBufferSizeEvent[(87, 37)] +2023/09/14 17:59:36 Read 1 events: +2023/09/14 17:59:36 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:59:37 Read 2 events: +2023/09/14 17:59:37 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:59:37 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:59:37 Read 1 events: +2023/09/14 17:59:37 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:59:38 Read 1 events: +2023/09/14 17:59:38 WindowBufferSizeEvent[(96, 41)] +2023/09/14 17:59:39 Read 1 events: +2023/09/14 17:59:39 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:59:40 Read 2 events: +2023/09/14 17:59:40 KeyEvent['d', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:59:40 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:59:42 Read 1 events: +2023/09/14 17:59:42 KeyEvent['d', up, KeyCode: 68, ScanCode: 32] +2023/09/14 17:59:58 Read 1 events: +2023/09/14 17:59:58 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:59:58 Read 2 events: +2023/09/14 17:59:58 KeyEvent['q', down, KeyCode: 0, ScanCode: 0] +2023/09/14 17:59:58 KeyEvent['q', up, KeyCode: 81, ScanCode: 16] +2023/09/14 17:59:58 Resetting input mode to: ENABLE_ECHO_INPUT|ENABLE_INSERT_MODE|ENABLE_LINE_INPUT|ENABLE_MOUSE_INPUT|ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE diff --git a/go.mod b/go.mod index b5e9e98..c46bcf9 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.17 require ( github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 + github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f github.com/mattn/go-isatty v0.0.18 github.com/mattn/go-localereader v0.0.1 github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b @@ -11,6 +12,7 @@ require ( github.com/muesli/reflow v0.3.0 github.com/muesli/termenv v0.15.2 golang.org/x/sync v0.1.0 + golang.org/x/sys v0.7.0 golang.org/x/term v0.6.0 ) @@ -19,6 +21,5 @@ require ( github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/rivo/uniseg v0.2.0 // indirect - golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.3.8 // indirect ) diff --git a/go.sum b/go.sum index 9bc66d6..ce379f5 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= @@ -37,6 +39,7 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/tea.go b/tea.go index 34fb883..4608ddc 100644 --- a/tea.go +++ b/tea.go @@ -21,10 +21,12 @@ import ( "syscall" "github.com/containerd/console" + "github.com/erikgeiser/coninput" isatty "github.com/mattn/go-isatty" "github.com/muesli/cancelreader" "github.com/muesli/termenv" "golang.org/x/sync/errgroup" + "golang.org/x/sys/windows" ) // ErrProgramKilled is returned by [Program.Run] when the program got killed. @@ -164,6 +166,10 @@ type Program struct { // below. windowsStdin *os.File //nolint:golint,structcheck,unused + conInput windows.Handle + cancelEvent windows.Handle + inputEvents []coninput.InputRecord + filter func(Model, Msg) Msg // fps is the frames per second we should set on the renderer, if @@ -185,6 +191,7 @@ func NewProgram(model Model, opts ...ProgramOption) *Program { p := &Program{ initialModel: model, msgs: make(chan Msg), + inputEvents: make([]coninput.InputRecord, 4), } // Apply all options to the program. @@ -208,8 +215,6 @@ func NewProgram(model Model, opts ...ProgramOption) *Program { termenv.WithColorCache(true)(p.output) } - p.restoreOutput, _ = termenv.EnableVirtualTerminalProcessing(p.output) - return p } @@ -524,6 +529,9 @@ func (p *Program) Run() (Model, error) { // Process commands. handlers.add(p.handleCommands(cmds)) + // Handle Windows console input. + handlers.add(p.handleConInput()) + // Run event loop, handle updates and draw. model, err := p.eventLoop(model, cmds) killed := p.ctx.Err() != nil diff --git a/tea_windows.go b/tea_windows.go new file mode 100644 index 0000000..62e1b5c --- /dev/null +++ b/tea_windows.go @@ -0,0 +1,164 @@ +package tea + +import ( + "fmt" + "log" + + "github.com/erikgeiser/coninput" + "golang.org/x/sys/windows" +) + +func enableWindowsConInput(p *Program) (func() error, error) { + con, err := windows.GetStdHandle(windows.STD_INPUT_HANDLE) + if err != nil { + return nil, fmt.Errorf("get stdin handle: %w", err) + } + + p.conInput = con + + var originalConsoleMode uint32 + + err = windows.GetConsoleMode(con, &originalConsoleMode) + if err != nil { + return nil, fmt.Errorf("get console mode: %w", err) + } + + log.Println("Input mode:", coninput.DescribeInputMode(originalConsoleMode)) + + newConsoleMode := coninput.AddInputModes( + 0, + windows.ENABLE_WINDOW_INPUT, + windows.ENABLE_MOUSE_INPUT, + // windows.ENABLE_PROCESSED_INPUT, + windows.ENABLE_EXTENDED_FLAGS, + // windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING, + ) + + log.Println("Setting mode to:", coninput.DescribeInputMode(newConsoleMode)) + + err = windows.SetConsoleMode(con, newConsoleMode) + if err != nil { + return nil, fmt.Errorf("set console mode: %w", err) + } + + cancelEvent, err := windows.CreateEvent(nil, 0, 0, nil) + if err != nil { + return nil, fmt.Errorf("create stop event: %w", err) + } + + p.cancelEvent = cancelEvent + + return func() error { + log.Println("Resetting input mode to:", coninput.DescribeInputMode(originalConsoleMode)) + + if err := windows.CloseHandle(p.cancelEvent); err != nil { + return fmt.Errorf("close stop event: %w", err) + } + + resetErr := windows.SetConsoleMode(con, originalConsoleMode) + if err == nil && resetErr != nil { + return fmt.Errorf("reset console mode: %w", resetErr) + } + + return nil + }, nil +} + +func (p *Program) handleConInput() chan struct{} { + ch := make(chan struct{}) + + go func() { + defer func() { + windows.SetEvent(p.cancelEvent) + close(ch) + }() + for { + select { + case <-p.ctx.Done(): + return + default: + if p.ctx.Err() != nil { + return + } + + if err := waitForInput(p.conInput, p.cancelEvent); err != nil { + log.Printf("wait for input: %s", err) + return + } + + n, err := coninput.ReadConsoleInput(p.conInput, p.inputEvents) + if err != nil { + log.Printf("read input events: %s", err) + return + } + + log.Printf("Read %d events:\n", n) + for _, event := range p.inputEvents[:n] { + log.Println(" ", event) + switch e := event.Unwrap().(type) { + case coninput.WindowBufferSizeEventRecord: + p.msgs <- WindowSizeMsg{ + Width: int(e.Size.X), + Height: int(e.Size.Y), + } + } + } + + } + } + }() + + return ch +} + +var errCanceled = fmt.Errorf("read cancelled") + +func waitForInput(conin, cancel windows.Handle) error { + event, err := windows.WaitForMultipleObjects([]windows.Handle{conin, cancel}, false, windows.INFINITE) + switch { + case windows.WAIT_OBJECT_0 <= event && event < windows.WAIT_OBJECT_0+2: + if event == windows.WAIT_OBJECT_0+1 { + return errCanceled + } + + if event == windows.WAIT_OBJECT_0 { + return nil + } + + return fmt.Errorf("unexpected wait object is ready: %d", event-windows.WAIT_OBJECT_0) + case windows.WAIT_ABANDONED <= event && event < windows.WAIT_ABANDONED+2: + return fmt.Errorf("abandoned") + case event == uint32(windows.WAIT_TIMEOUT): + return fmt.Errorf("timeout") + case event == windows.WAIT_FAILED: + return fmt.Errorf("failed") + default: + return fmt.Errorf("unexpected error: %w", error(err)) + } +} + +type overlappedReader windows.Handle + +// Read performs an overlapping read fom a windows.Handle. +func (r overlappedReader) Read(data []byte) (int, error) { + hevent, err := windows.CreateEvent(nil, 0, 0, nil) + if err != nil { + return 0, fmt.Errorf("create event: %w", err) + } + + overlapped := windows.Overlapped{HEvent: hevent} + + var n uint32 + + err = windows.ReadFile(windows.Handle(r), data, &n, &overlapped) + if err != nil && err != windows.ERROR_IO_PENDING { + return int(n), err + } + + err = windows.GetOverlappedResult(windows.Handle(r), &overlapped, &n, true) + if err != nil { + return int(n), nil + } + + return int(n), nil +} diff --git a/tty_windows.go b/tty_windows.go index be415ae..1e39108 100644 --- a/tty_windows.go +++ b/tty_windows.go @@ -4,9 +4,11 @@ package tea import ( + "log" "os" "github.com/containerd/console" + "github.com/muesli/termenv" ) func (p *Program) initInput() error { @@ -24,6 +26,13 @@ func (p *Program) initInput() error { p.console = c } + var err error + p.restoreOutput, err = enableWindowsConInput(p) + if err != nil { + log.Printf("Error enabling Windows console input: %s", err) + p.restoreOutput, _ = termenv.EnableVirtualTerminalProcessing(p.output) + } + return nil }