Skip to content

Commit

Permalink
Set ENABLE_VIRTUAL_TERMINAL_INPUT on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Oct 3, 2021
1 parent ab60d77 commit 0b45391
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cancelreader_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@ func prepareConsole(input windows.Handle) (reset func() error, err error) {
newMode |= windows.ENABLE_INSERT_MODE
newMode |= windows.ENABLE_QUICK_EDIT_MODE

newMode &^= windows.ENABLE_VIRTUAL_TERMINAL_INPUT
// Enabling virutal terminal input is necessary for processing certain
// types of input like X10 mouse events and arrows keys with the current
// bytes-based input reader. It does, however, prevent cancelReader from
// being able to cancel input. The planned solution for this is to read
// Windows events in a more native fashion, rather than the current simple
// bytes-based input reader which works well on unix systems.
newMode |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT

err = windows.SetConsoleMode(input, newMode)
if err != nil {
Expand Down

0 comments on commit 0b45391

Please sign in to comment.