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/example@v0.6.0  # has the fix (or @latest)

go run fortio.org/terminal/example@v0.5.1  -history .history # does not have working arrow keys/this fix

Fixes golang/go#68830

Change-Id: If20addd054c76b889a52f933695467812be72306
GitHub-Last-Rev: 68e3ca0e19d5c5ac1848d8135638c809f593e035
GitHub-Pull-Request: golang/term#17
Reviewed-on: https://go-review.googlesource.com/c/term/+/603960
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
1 file changed
tree: ac382dc291ca7d1b1abdfc30ac3162051ac57751
  1. codereview.cfg
  2. CONTRIBUTING.md
  3. go.mod
  4. go.sum
  5. LICENSE
  6. PATENTS
  7. README.md
  8. term.go
  9. term_plan9.go
  10. term_test.go
  11. term_unix.go
  12. term_unix_bsd.go
  13. term_unix_other.go
  14. term_unsupported.go
  15. term_windows.go
  16. terminal.go
  17. terminal_test.go
README.md

Go terminal/console support

Go Reference

This repository provides Go terminal and console support packages.

Download/Install

The easiest way to install is to run go get -u golang.org/x/term. You can also manually git clone the repository to $GOPATH/src/golang.org/x/term.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.

The main issue tracker for the term repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/term:” in the subject line, so it is easy to find.