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

C-[ not recognized on Windows #677

Closed
superlou opened this issue Aug 30, 2021 · 7 comments
Closed

C-[ not recognized on Windows #677

superlou opened this issue Aug 30, 2021 · 7 comments
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug O-windows Operating system: Windows upstream

Comments

@superlou
Copy link
Contributor

Reproduction steps

On Windows 10 in both Powershell and CMD, C-[ does not match the behavior of Esc as it does on Linux. This was discovered during the conversation in #661. Explicitly mapping it as in the following config.toml does not seem to be recognized either:

theme = "bogster"

[keys.insert]
"C-[" = "normal_mode"

The theme is set to verify that config.toml is being successfully loaded. While my understanding is that the mechanism for the behavior of C-[ and Esc matching on Linux is a property of the terminal, it would be nice to match out-of-the-box for multiplatform support, or at least allow the explicit mapping.

Environment

  • Platform: Windows 10 Pro 21H1,
  • Helix version: helix 0.4.1
  • Keyboard: Microsoft Natural Ergonomic Keyboard 4000 v1.0

The helix.log file is blank.

@superlou superlou added the C-bug Category: This is a bug label Aug 30, 2021
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Aug 30, 2021
@pickfire pickfire added the O-windows Operating system: Windows label Aug 31, 2021
@superlou
Copy link
Contributor Author

superlou commented Aug 31, 2021

Not sure if it helps narrow down what's going on, but "A-[" maps via config.toml. It seems "C-]" and "C-." aren't recognized either, but "C-c" is. Something about Ctrl plus non-alphanumeric characters?

Edit: neovim responds as expected to "C-[", so it should be possible. I'll try to figure out where Helix is handling keyboard input.

@WindSoilder
Copy link
Contributor

WindSoilder commented Nov 20, 2021

Trying to investigate on it, and find that it's the issue in crossterm

@WindSoilder
Copy link
Contributor

Have open a PR for this scenario crossterm-rs/crossterm#619

Let's see how it goes... Hope that implementation is ok :-)

@superlou
Copy link
Contributor Author

superlou commented Dec 2, 2021

Your patch worked on my system to get crossterm to recognize the offending sequences. If the crossterm maintainers don't accept it, is there a way it can be applied at the helix level? It seems like it would be a shame to have to maintain a forked crossterm.

@WindSoilder
Copy link
Contributor

Your patch worked on my system to get crossterm to recognize the offending sequences

Glad that works :-)

is there a way it can be applied at the helix level

Sadly I don't think so, because the relative parse function is private, and it's hard to adjust outside crossterm.

it would be a shame to have to maintain a forked crossterm.

Agree with that, what if we just modify our cargo.toml locally? Make the crossterm dependency temporary connect to other repo? As example, we can modify crossterm dependency to something like this:

crossterm = { version = "0.22", features = ["event-stream"], git = "https://github.com/WindSoilder/crossterm" }

And we can revert it back as soon as that original issue is solved.

Here is the reference: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-git-repositories

@superlou
Copy link
Contributor Author

Seeing the mention of a switch to termwiz in #1472, is there any chance termwiz handles this? It seems like crossterm isn't accepting PRs very quickly.

@superlou
Copy link
Contributor Author

superlou commented Feb 6, 2022

It looks like @WindSoilder 's PR has landed in Crossterm 0.23!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug O-windows Operating system: Windows upstream
Projects
None yet
Development

No branches or pull requests

5 participants