From 4bc3f81a029a04320f53541a3e3fbf7ae8a0e584 Mon Sep 17 00:00:00 2001 From: Stephen Baynham Date: Thu, 7 Nov 2024 15:29:29 -0800 Subject: [PATCH] add ReadQueryResponses method that will read ansi responses on windows --- input/driver.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/input/driver.go b/input/driver.go index 5492b348..ca4db0f8 100644 --- a/input/driver.go +++ b/input/driver.go @@ -53,6 +53,13 @@ func NewDriver(r io.Reader, term string, flags int) (*Driver, error) { return d, nil } +// ReadQueryResponses is equivalent to ReadEvents on non-Windows systems. However, +// on windows systems this method will pull ansi responses from the tty instead of trying +// to pull key/mouse input from windows' ReadConsoleInput syscall, which is what ReadEvents does +func (d *Driver) ReadQueryResponses() (e []Event, err error) { + return d.readEvents() +} + // Cancel cancels the underlying reader. func (d *Driver) Cancel() bool { return d.rd.Cancel()