Skip to content

Commit f867b76

Browse files
ldemaillygopherbot
authored andcommitted
x/term: set missing VIRTUAL_TERMINAL_INPUT flag on Windows
With this change the arrow keys work with Windows 11 Terminal After verifying https://github.com/containerd/console did work fine, unlike x/term, it's because they have: https://github.com/containerd/console/blob/v1.0.4/console_windows.go#L194 using the same flag fixed x/term for my program Small e2e test reproducing the issue and showing it being fixed can be ran using go run fortio.org/terminal/[email protected] # has the fix (or @latest) go run fortio.org/terminal/[email protected] -history .history # does not have working arrow keys/this fix Fixes golang/go#68830 Change-Id: If20addd054c76b889a52f933695467812be72306 GitHub-Last-Rev: 68e3ca0 GitHub-Pull-Request: #17 Reviewed-on: https://go-review.googlesource.com/c/term/+/603960 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Commit-Queue: Ian Lance Taylor <[email protected]> Reviewed-by: Alex Brainman <[email protected]>
1 parent d598954 commit f867b76

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

term_windows.go

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func makeRaw(fd int) (*State, error) {
2626
return nil, err
2727
}
2828
raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
29+
raw |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT
2930
if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
3031
return nil, err
3132
}

0 commit comments

Comments
 (0)