From c21e9edad43984dbdaac02b53a02819583142cc3 Mon Sep 17 00:00:00 2001 From: Michael Kelley Date: Sun, 15 Aug 2021 00:01:50 -0700 Subject: [PATCH] Restore VT hack for Windows (#2580) - restore VT enable hack - resolve an issue reported in https://github.com/kelleyma49/PSFzf --- src/tui/light_windows.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tui/light_windows.go b/src/tui/light_windows.go index 06e77ba0..875bf6f3 100644 --- a/src/tui/light_windows.go +++ b/src/tui/light_windows.go @@ -73,6 +73,9 @@ func (r *LightRenderer) initPlatform() error { fd := int(r.inHandle) b := make([]byte, 1) for { + // HACK: if run from PSReadline, something resets ConsoleMode to remove ENABLE_VIRTUAL_TERMINAL_INPUT. + _ = windows.SetConsoleMode(windows.Handle(r.inHandle), consoleFlagsInput) + _, err := util.Read(fd, b) if err == nil { r.ttyinChannel <- b[0]