Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/term: set missing VIRTUAL_TERMINAL_INPUT flag on Windows #17

Closed
wants to merge 1 commit into from

Conversation

ldemailly
Copy link
Contributor

@ldemailly ldemailly commented Aug 10, 2024

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

@gopherbot
Copy link
Contributor

This PR (HEAD: 68e3ca0) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/term/+/603960.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Laurent Demailly:

Patch Set 1:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Ian Lance Taylor:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@ldemailly ldemailly changed the title x/term: windows: fix arrow keys non functional (not received) x/term: set missing VIRTUAL_TERMINAL_INPUT flag on Windows Aug 10, 2024
@gopherbot
Copy link
Contributor

Message from Laurent Demailly:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Laurent Demailly:

Patch Set 2:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Alex Brainman:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Laurent Demailly:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Laurent Demailly:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Laurent Demailly:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Alex Brainman:

Patch Set 5: Commit-Queue+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go LUCI:

Patch Set 5:

Dry run: CV is trying the patch.

Bot data: {"action":"start","triggered_at":"2024-08-23T08:48:54Z","revision":"28757e401eec8d49371c43809472b50087436a61"}


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Alex Brainman:

Patch Set 5: -Commit-Queue


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go LUCI:

Patch Set 5:

This CL has passed the run


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go LUCI:

Patch Set 5: LUCI-TryBot-Result+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Alex Brainman:

Patch Set 5: Code-Review+2

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Alex Brainman:

Patch Set 5:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Cherry Mui:

Patch Set 5: Code-Review+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/603960.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Aug 24, 2024
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: 68e3ca0
GitHub-Pull-Request: #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>
@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/603960 has been merged.

@gopherbot gopherbot closed this Aug 24, 2024
@ldemailly ldemailly deleted the fix_68830 branch August 24, 2024 03:14
ldemailly added a commit to fortio/term that referenced this pull request Jan 26, 2025
* 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: 68e3ca0
GitHub-Pull-Request: golang#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>

* go.mod: update golang.org/x dependencies

Update golang.org/x dependencies to their latest tagged versions.

Change-Id: Ia875ad082f993ce02f2cf97d6d3b318091360433
Reviewed-on: https://go-review.googlesource.com/c/term/+/610637
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>

* go.mod: update golang.org/x dependencies

Update golang.org/x dependencies to their latest tagged versions.

Change-Id: I1fc21941bdc8066f3a8d24afdf16e6e10bceaf55
Reviewed-on: https://go-review.googlesource.com/c/term/+/617955
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

* README: don't recommend go get

These days people will just import the packages and the go tool will
do the right thing. We don't need to explain it.

Add a pointer to the git repo, though.

For golang/go#62645

Change-Id: I641439c4fa02391fb77b05d639d6815094724a3a
Reviewed-on: https://go-review.googlesource.com/c/term/+/624216
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

* go.mod: update golang.org/x dependencies

Update golang.org/x dependencies to their latest tagged versions.

Change-Id: I4ba440821ddd8ce48c2658e67836ff4fbcdd258d
Reviewed-on: https://go-review.googlesource.com/c/term/+/626355
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>

* go.mod: update golang.org/x dependencies

Update golang.org/x dependencies to their latest tagged versions.

Change-Id: I8348c05748f22f6b6701a197b29e8b6dba837d0d
Reviewed-on: https://go-review.googlesource.com/c/term/+/633476
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>

* go.mod: update golang.org/x dependencies

Update golang.org/x dependencies to their latest tagged versions.

Change-Id: Ib4be7af15f194517725e80dde8b52ce59dce04c9
Reviewed-on: https://go-review.googlesource.com/c/term/+/640357
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>

* Expose History() AddToHistory() and NewHistory() so users of the library can save and restore the history

* prep for release under fortio.org/term (#2)

* Don't add adjacent duplicates to history (#3)

* Add AutoHistory(false) option (default remains true) to not automatically add to the History (#4)

* Add AutoHistory(false) option (default remains true) to not automatically add to the History and let the caller of ReadLine() decide, for instance to only add validated commands

* Add ReplaceLatest() to mutate top of history. Add comments. Expose DefaultHistoryEntries as const (#5)

* Add ReplaceLatest() to mutate top of history. Add comments. Expose DefaultHistoryEntries as const

* Correct godoc for ReplaceLatest

* Change history default to 99 from 100 so history printed with %02d looks good (#7)

---------

Co-authored-by: Gopher Robot <gobot@golang.org>
Co-authored-by: Ian Lance Taylor <iant@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x/term: windows: arrow keys not received and thus history not working
2 participants