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
Comment Line command cannot be used on German keyboards #1167
Comments
Thanks for report this issue! The Cmd + / command is defined by a CodeMirror addon, specifically the Sublime Text keymap. I'm sure other folks have run into this issue using CodeMirror with non-US keyboards, but I'm having a hard time figuring out how others have solved this (here's an example of someone having the same issue: jupyter/notebook#3753). I tried using a German keyboard with Sublime text, and I noticed that Cmd + Shift + 7 does work for commenting/uncommented. I'm a little stumped about how to fix this issue. I'm very open to thoughts and ideas! |
Yes, I use it in Sublime all the time. Most other (standalone) code editors have the same shortcut that works well. The issue here is simply that it clashes with the predefined browser shortcuts, I think. I just checked other code editors (CodePen and jsfiddle) and they suffer from the same problem. However, since accessibility is such an important part for p5.js, it would be great to find an actual solution to this problem. I think by far the easiest approach would be to additionally offer an alternative shortcut for commenting, something like Cmd + K perhaps? |
agreed! i wonder what another common shortcut for commenting code is? all i could find is in visual studio, it uses Cmd + K + C to comment and Cmd + K + U to uncomment. |
Not sure about common ones. But I seem to remember that somewhere I had to use Cmd + K. I can't for the life of me remember which package it was. Anyway, Cmd + K does not seem to conflict with anything else in the three browsers I tested it with (Safari, Chrome, Firefox), at least on Mac. Could maybe somebody check on Windows/other browsers? Currently I am not even sure, if this is a Mac problem only, or if it only affects Windows users. Any German Windows p5 users here? |
i should be able to test this by using browser stack + switching my keyboard to a german keyboard. let me try it and report back... |
btw, i did some research, and apparently Cmd + K is a keyboard shortcut from notepad++. |
hmm, i noticed that Cmd + K and Ctrl + K seemed to be mapped to a keyboard shortcut that deletes the text from where the cursor is to the end of the line. so i think, unfortunately, we'll have to figure out a different shortcut! |
Ah, okay. I didn't realize that all the Sublime Shortcuts are mapped into the p5 editor. Well, in this case it's probably best to have a close look at a Sublime Shortcut List and figure out which keys are still available. |
It would be nice to not override them if possible, but I'm willing to do it where it makes sense! |
Hm, okay, I looked at the Sublime Shortcut list (which was highly educational btw 😄 ) and it seems most keys are taken. Those that are not taken are in turn taken by the browser. I thought Cmd + # might be a good shortcut, as it can be typed without using Shift on a German keyboard, but I figured that the Spanish keyboard layout probably suffers from the same commenting issue and on the spanish keyboard, the The only shortcut that I found now that seems to neither interfere with default browser shortcuts, nor with Sublime shortcuts and is easy to type would be Cmd + .. At least as far as I can tell. I am not sure, seems a bit weird to map a commenting shortcut to such an important key. What do you think? |
I like Cmd (Ctrl on windows) + .! I also like that it's close to the / key, at least on a QWERTY/US keyboard. |
I have a macbook and I use jupyter from Firefox. I have tried all possible combinations for commenting/uncommenting a part of code but no luck. Any tip? How can I modify the shortcuts? |
Only two options that I know of currently: 1.) Use an external keyboard with a numpad and use Cmd + / (the / on the numpad) 2.) Use a third party software for remapping your keys. I did this on my Mac using Keyboard Maestro, and setting up a custom Macro for remapping my keys in Firefox, see attached screenshot. |
Thanks. I also found a crazy solution but it is not very convenient but it works regardless of the keyboard's language.
|
Yeah, that is just inserting multiple cursor and works regardless of keyboard language, but does not really help you if you already have multiple selections that you want to comment out via shortcut. |
After looking over this discussion again, I think the right solution is to add Command/Control + . as an alternative keyboard shortcut for different keyboard layouts. |
I agree. That should be simple to implement and give all those an easy alternative that cannot use the primary shortcut. |
Hey, not sure if this is the right place or a new issue should be opened.
Note: |
Thank you @SunFIow for the research! Maybe this is only true for American keyboards or Mac OS keyboards, but the Control key is also denoted by the shorthand ⌃. I think it would make sense to change the keyboard shortcuts to say Ctrl if that feels more clear! |
For several days I had been looking for a real answer. Thanks to this post (https://stackoverflow.com/questions/19318298/how-can-i-block-comment-code-in-the-ipython-notebook/54762141#54762141 ) I did!! It was as simple as a notebook extension on which you can customise the comment command!!! Lovely! |
@catarak another German here... In effect I would like to second the idea of @SunFIow . It would be a great help to have documentation about the keyboard shortcuts that work on German keyboards. On the other hand I like the uncluttered UI as it is. As for my motivation for adding to this seemingly old and low-priority Issue: |
@arathorn76 thank you for your thoughts and apologies for not being on top of this issue! It's really helpful. It seems like there's an consensus around:
Are there other keyboard shortcuts that aren't working for you? It would be great to know more.
I'm not sure it makes sense to tie the keyboard layout to the selected translation. My instinct is that these don't line up 100% of the time. |
@catarak I composed a cheat sheet for my personal use that I just updated. It now reflects the answer to your question.
Your instinct is absolutely right. I´m an example of this. I´m using a German keyboard yet my editor settings point to English. I´m using and thinking most tchnical terms in english so I make my editor line up to that. |
Add another extraKeys entry for toggleComment and add an entry in the keyboard reference
internationalise comment shortcut fixes #1167
Nature of issue?
Details about the bug:
Using Cmd + / to comment lines does not work on a German (and possibly other) keyboard layouts as to type a
/
you have to use Shift + 7, so the comment keyboard shortcut becomes Cmd + Shift + 7. This shortcut however triggers some native browser functions (brings you to the menu search in Firefox and Chrome, brings you to some Tab overview in Safari).So to allow for German/international users to utilize this shortcut would either require to overwrite the native browser commands or to add an alternative shortcut to comment lines.
The text was updated successfully, but these errors were encountered: