-
Notifications
You must be signed in to change notification settings - Fork 115
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
Ctrl + Slash will now comment and uncomment your selected lines of code #110
base: master
Are you sure you want to change the base?
Conversation
whats that on non-US keyboards |
I haven't tested it but it should work for any keyboard layout. Wherever your "/" is on your keyboard it should work. GLFW abstracts away keys and scan codes and knows how to map keys across different layouts. If it doesn't work though then let me know |
Doesn't seem to work on my Mac Fench AZERTY layout.
All of which to no avail. EDIT: Looking at the code, it seem to be a GLFW issue, so I don't know if there is a possible fix in Bonzo. I will try to test directly GLFW, but it's not the first time I ran into issues like this with this layout. |
Just FYI, Visual Assist adds/removes single-line comments on |
I chose Ctrl/Cmd + / because that's what I am used to from Xcode and Visual Studio Code. We can add a different keyboard shortcut that works universally across keyboard layouts, but I'd like to keep Ctrl + / in there. Or maybe someone can figure out why Ctrl + / isn't working universally like I thought it would.
Nice. I haven't tried Visual Assist. Reading about it now. Sounds great. |
I could add the same shortcuts that visual assist has |
To be honest I'm not sure about this, it's something I'd personally enjoy but it sounds too specific to be useful across the board in competitions and the fact that it's geared towards a smaller group of people makes it slide into the "add neovim" territory. |
In my opinion this feature is good because it's a standard feature in any good code editor. It's not geared towards a limited group of people. Contestants of shader coding competitions would all be exposed to IDEs with this same feature (and I'd bet most of them have used this feature). In competitions, the ability to very speedily comment and uncomment out blocks of code is useful when you're experimenting trying to create the best code for good effects by turning things on and off and seeing what looks good. We could get an additional key mapping for the feature by having Ctrl + K for example rather than a symbol or even use one of the function keys |
Also I doubt anyone would dislike this feature so it’s definitely worth considering. I mainly added it because it’s the one thing that the code editor was lacking |
7f59c4b
to
4cd1184
Compare
I just added Ctrl/Cmd K to comment out code too. This should work for everyone :) |
0e5d5bd
to
e17a254
Compare
I feel if we add this, we'd be better off supporting |
So in other words, /**/ when multiple lines are selected and // for a single line? Or separate key combos for /**/ and // (where // will be inserted at the beginning of every line selected)? I'm happy to implement the feature to how you'd like it, but I'd like to know exactly what your expected behaviour of this feature is. Thanks |
The way it works in VS/VAX is that:
I suggest you try it before you write more code. |
OK no problem. Can we have this as an addition to the current commenting behaviour? Just so that it caters for people used to other IDEs |
Catering to too many things is a slippery slope - this is not a general purpose editor, it's a tool for a very specific live coding compo. This is already pushing it. |
I have added the behaviour as described. Now since the '/' button doesn't seem to work for non US keyboard layouts, I have not removed the old functionality yet. I can remove the old functionality if you want, but I'd like to know how to solve the '/' issue. For now, with the old functionality, I have also added support to use 'K' instead of '/' so you can use Ctrl + K to comment lines of code. Please have a play around with it to see if you like it and provide feedback if you'd like anything changed. :) |
Hi, it's been a while since this was last commented on. I was just using the release build of Bonzomatic and tried to mass comment out my selected text and remembered my feature hadn't been merged yet. I was wondering if we could get this useful feature merged or if it needs work let me know what I should change. Thanks |
1fd7f15
to
d0e5cf2
Compare
Seems to work, except I have the same issue maeln had: I need to press Ctrl+= or Ctrl+Shift+! (== Ctrl+8) instead of resp. Ctrl+Shift+: (== Ctrl+/) and Ctrl+Shift+$ (== Ctrl+*). This is Belgian AZERTY. Not exactly intuitive when you have no QWERTY keyboards. Is there any way to fix this? (eg. using SDL has a charcodes<->keycodes distinction, do GLFW etc. have something like that?) |
If you look at my changes to main.cpp and renderer.cpp, you see the key handling code there. If someone knows of a better way of doing that than my implementation then that would be awesome |
Tried fixing it unsuccessfully, but, apparently it's a known bug in GLFW. sigh. |
This sucks. Maybe we could somehow have customisable key commands in the config.json |
Yeah that'd also be ok I guess. |
This was one of the things that Bonzomatic lacked which most IDE's have.
You can comment or uncomment your current line of code or all lines you have selected with Ctrl/Cmd + /