2
0
mirror of https://github.com/junegunn/fzf synced 2024-11-12 07:11:11 +00:00

Restore VT hack for Windows (#2580)

- restore VT enable hack
- resolve an issue reported in https://github.com/kelleyma49/PSFzf
This commit is contained in:
Michael Kelley 2021-08-15 00:01:50 -07:00 committed by GitHub
parent 9c21a20f8b
commit c21e9edad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]