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

Windows Terminal intercepts some ctrl key sequences #2973

Closed
herop opened this issue Apr 25, 2020 · 5 comments
Closed

Windows Terminal intercepts some ctrl key sequences #2973

herop opened this issue Apr 25, 2020 · 5 comments

Comments

@herop
Copy link

@herop herop commented Apr 25, 2020

What did you expect to happen?
That I can do as expected:

  • C-c c-^ -> nothing happens
  • C-c c-<-> C-c c-\ is undefinded
  • C-c c->-> nothing happens
  • C-c c-_-> text on my screen becomes smaller

What actually happened?
See above.
I wonder, if this only stems from my use of WSL - BUT:

  • Keys like the ^ only occur if a SPC is pressed afterwards
  • I can't think of another key you are referring, if so, I would be glad to hear about 😸
  • The < just wont function together with C- and at leaset the > key HAS to see a SHIFT together pressed

Additional details:

  • Include a link to your private config
    I'l happily obey if necessary, but we are in a different ballpark here, I assume.

  • Include screenshots/casts of your issue
    image
    image

  • If you mention key sequences, include what commands they're bound to (use SPC h k KEY or C-h h k KEY to inspect keys).

  • Include any warnings or errors logged to *Messages* (use M-x view-echo-area-messages to see it).

If an error message is involved include a backtrace of it.
No error (but see my screenshot above)
How to acquire a backtrace:
https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#how-to-extract-a-backtrace-from-an-error

Steps to reproduce:

  1. Select these example steps,
  2. Delete them,
  3. And replace them with precise steps to reproduce your issue.
  4. Fill in "system information" below.

System information:
Windows10 Insider Build Fast
WSL Debian on Terminal Preview (Insider, installed yesterday.

Place the output of `M-x doom/info` or `~/.emacs.d/bin/doom info` here.
Package cl is deprecated
((emacs
  (version . "27.0.91")
  (features . "XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS PDUMPER LCMS2 GMP")
  (build . "Apr 24, 2020")
  (buildopts "")
  (windowsys . batch)
  (daemonp))
 (doom
  (version . "2.0.9")
  (build . "HEAD -> develop 30dea4bf0 2020-04-25 02:55:06 -0400")
  (dir . "~/.doom.d/"))
 (system
  (type . gnu/linux)
  (config . "x86_64-pc-linux-gnu")
  (shell . "/bin/zsh")
  (uname . "Linux 4.4.0-19613-Microsoft #1000-Microsoft Thu Apr 17 15:57:00 PST 2020 x86_64")
  (path "/usr/local/sbin" "/usr/local/bin" "/usr/sbin" "/usr/bin" "/sbin" "/bin" "/usr/games" "/usr/local/games" "/mnt/c/Python38/Scripts/" "/mnt/c/Python38/" "/mnt/c/ProgramData/DockerDesktop/version-bin" "/mnt/c/Program Files/Docker/Docker/Resources/bin" "/mnt/c/Program Files (x86)/Razer Chroma SDK/bin" "/mnt/c/Program Files/Razer Chroma SDK/bin" "/mnt/c/WINDOWS/system32" "/mnt/c/WINDOWS" "/mnt/c/WINDOWS/System32/Wbem" "/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/" "/mnt/c/WINDOWS/System32/OpenSSH/" "/mnt/c/Users/JochenBurkhard/AppData/Local/Microsoft/WindowsApps" "/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common" "/mnt/c/ProgramData/chocolatey/bin" "/mnt/c/WINDOWS/system32" "/mnt/c/WINDOWS" "/mnt/c/WINDOWS/System32/Wbem" "/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/" "/mnt/c/WINDOWS/System32/OpenSSH/" "/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn/" "/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/" "/mnt/c/Program Files/Git/cmd" "/mnt/c/Program Files (x86)/Pandoc/" "/mnt/c/Program Files/Pandoc/" "/mnt/c/Program Files/nodejs/" "/mnt/c/Program Files/dotnet/" "/mnt/c/Program Files/PowerShell/7-preview/preview" "/mnt/c/Users/JochenBurkhard/scoop/apps/gcc/current/bin" "/mnt/c/Users/JochenBurkhard/scoop/shims" "/mnt/c/Users/JochenBurkhard/AppData/Local/GitHubDesktop/bin" "/mnt/c/Users/JochenBurkhard/AppData/Local/Programs/Microsoft VS Code Insiders/bin" "/mnt/c/texlive/2019/bin/win32" "/mnt/c/Users/JochenBurkhard/AppData/Local/Programs/espanso" "/mnt/c/Users/JochenBurkhard/AppData/Roaming/npm" "/mnt/c/Users/JochenBurkhard/Dropbox/Text" "/mnt/c/Program Files/Emacs/x86_64/bin" "/mnt/c/Users/JochenBurkhard/AppData/Local/Microsoft/WindowsApps" "/usr/local/libexec/emacs/27.0.91/x86_64-pc-linux-gnu"))
 (config
  (envfile . envvar-file)
  (elc-files . 0)
  (modules :completion company helm ivy :ui doom doom-dashboard hl-todo modeline neotree ophints (popup +defaults) pretty-code tabs treemacs unicode vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold snippets :emacs dired electric ibuffer undo vc :checkers syntax spell grammar :tools (eval +overlay) lookup magit :lang emacs-lisp (org +roam) sh :app (rss +org) :config (default +bindings +smartparens))
  (packages (org-roam :recipe (:host github :repo "jethrokuan/org-roam" :branch "develop")))
  (unpin "n/a")
  (elpa "xclip" "s" "popup" "parsebib" "org-roam-bibtex" "org-roam" "helm-fd" "helm-core" "helm" "fd-dired" "f" "emacsql-sqlite" "emacsql" "dired-fdclone" "dash" "company-org-roam" "company" "clipetty" "bibtex-completion" "biblio-core" "biblio" "async")))
@herop herop added the 1. bug label Apr 25, 2020
@herop
Copy link
Author

@herop herop commented May 1, 2020

Even though it might have to do with keyboard/mappings, I tried the US keyboard and any combination of keyboard-shortcuts present in the org-mode keys.
A little more love hear would be highly appreciated.

Loading

@hlissner
Copy link
Owner

@hlissner hlissner commented May 5, 2020

I'm afraid I can't look into this, as I don't have a Windows system handy, and know little about WSL. That said, you mention Terminal Preview, which implies you're running Emacs in the terminal, rather than GUI Emacs. Can you reproduce this in GUI Emacs?

Unix terminals tend to be particular about how they translate certain key codes (sometimes ignoring certain combinations altogether), so I suspect that may be the case here as well. I don't know anything about Windows terminals, so I can't offer any insight on how to fix the issue.

At the very least, I don't think this is a Doom (or even an Emacs) issue.

Loading

@hlissner hlissner added this to Known issues in Upstream bugs via automation May 5, 2020
@marcus-crane
Copy link
Contributor

@marcus-crane marcus-crane commented May 11, 2020

Hey @herop,

I'm a fairly new user to Emacs in general but I've just recently set it up on my desktop, which uses WSL 2. I also happen to use the new Windows Terminal so I did some testing and I think I've found some answers for you.

For starters, Windows Terminal itself has some hidden keybindings which can be quite annoying. You won't find them in the user configurable JSON (under Settings in the dropdown) but you can see them here:

https://github.com/microsoft/terminal/blob/master/src/cascadia/TerminalApp/defaults.json#L333

You mentioned that C-c C-_ zooms your screen out? If you're in fact hitting C-c C-minus accidentally, the C-minus is being interpreted by Windows Terminal as a request to adjust the font size. It's nothing related to Emacs.

Assuming that I'm reading C-c C-> correctly as being C-c C-S-> (S for shift), then you'll also find that doesn't work which is quite strange.

Once again, another quirk for Windows Terminal, argh.

Check out this comment here: microsoft/terminal#3079 (comment)

It seems that Windows Terminal treats Ctrl and Ctrl + Shift exactly the same!

I came up with a little test to validate this. Within org mode, C-c C-l is org-insert-link while C-c C-S-l is +org/remove-link

Typing C-c C-S-l in Emacs GUI (WSL2 pointing at an X display server) rightly tells me "No link at point". It's correctly triggering +org/remove-link.

Typing C-c C-S-l in Emacs Terminal however asks me to insert a link! It is indeed falling through and triggering the command bound to C-c C-l.

Typing C-c C-\ or even just C-\ actually triggers 1Password for me funnily enough. It seems to be a popular key combo for Windows apps in general? It even triggers when using Emacs GUI so I'm not sure what can be done about that, besides either closing any apps that use it, or rebinding that key.

Hopefully this is enough to convince you to try out Emacs using a display server rather than the Windows Terminal, since it seems like a much nicer experience.

Similarly, @hlissner I hope this post means you can remove one more bug off of your list of things to do. I'll see if I can contribute something to that missing WSL 2 portion of the install docs now as well, seeing that I now know a little bit more than last week.

Loading

@herop
Copy link
Author

@herop herop commented May 11, 2020

If I'm the only one complaining you could close the issue. I no longer care.
Thank you for taking the time.

Loading

@hlissner
Copy link
Owner

@hlissner hlissner commented May 13, 2020

In that case I'll consider the issue external and close this.

@marcus-crane Thank you so much for looking into this and sheding light on it with such a detailed bug report! It is much appreciated.

Loading

@hlissner hlissner closed this May 13, 2020
Upstream bugs automation moved this from Known issues to Resolved May 13, 2020
@hlissner hlissner moved this from Resolved to Known issues in Upstream bugs May 14, 2020
@hlissner hlissner changed the title Keybindings do not work (at least Windows WSL) Windows Terminal consumes some ctrl key sequences Jul 24, 2020
@hlissner hlissner changed the title Windows Terminal consumes some ctrl key sequences Windows Terminal intercepts some ctrl key sequences Jul 24, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Upstream bugs
  
Known issues
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants