-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Added OS X compatible behaviour for text editing #473
Conversation
This is a great PR but imo it would have been better to put the trailing spaces cleanup in a separate PR as it makes it more clear what code that actually has been changes. I of course leave it to @ocornut to decide this :) |
I agree I'd prefer if the trailing spaces were in a separate commit. I'm probably going to remove trailing spaces locally before merging or something, and skip stb_textedit.h there. Don't worry too much (unless it is easy for you to reapply). Will review in more details later (as InputTextEx() is notoriously full of traps) but it looks good |
Oh okay, yea I totally forgot I had set my editor to trim trailing spaces. Oops. |
@zhiayang Would you mind suggesting the changes to stb_textedit.h via a PR in its repo? |
Any news about this feature ? |
Wanted to look at it last weekend but the PR is rather messy with all the removed spaces. Will look into it this week-end probably! |
Thanks ! |
Also need to submit the stb_textedit.h part to the stb repro |
… Windows key in theory although the later is hard to read) (#473) NB: Value not used.
… OS X Compatible behavior (#473)
…ic for OS X compatible behavior (#473)
Merged everything (with minor tweaks/comments) apart from the stb_textedit.h patch which a/ breaks windows behavior b) should be PR-ed upstream even if we merge ourselves earlier. This became very tricky because of the white-space changes, having everything in the same commit, and altering stb_textedit.I had to hand-merge everything now (unfortunately you don't get the karma points from Github because of that). Learning for next time! Even how small the feature are, split them in different commits so we can cherry-pick and let the validated features "pass" asap, to leave only the the debatable ones and clear the noise. PS: |
…ve-right handlers (following #473)
I have now rearranged the modifications to stb_textedit in a way that makes more sense for a pull request there and applied the similar change for OSX style behavior on OSX only (based on Note that this will break user application that update core imgui and but have KeySuper set. |
FYI stb_textedit.h patch posted to nothings/stb#273 |
FYI in the latest version I have renamed (Even though there is a |
Addresses issue raised by me in issue #456, near the bottom.
Changes these things:
KeySuper
is now a field inImGuiIO
, and is now set by the various backends where it makes sense: GLFW (OpenGL and OpenGL3), SDL (OpenGL and OpenGL3), Allegro and Marmalade. I couldn't figure out if Windows passes Win key events to applications, so I left out the DirectX backends.ImGuiIO
;bool WordMovementUsesAltKey
,bool ShortcutsUseSuperKey
,bool DoubleClickSelectsWord
, andbool MultiSelectUsesSuperKey
. These fields control the new, modified behaviour that I set up.#define
has been added.Based on these fields, on OS X (or when
__APPLE__
is defined), the following changes to text editing take place:ShortcutsUseSuperKey == true
.DoubleClickSelectsWord == true
.WordMovementUsesAltKey == true
.@ocornut: I didn't put LSuper/RSuper in the enum field for
ImGuiKey_
, since there aren't entries for Ctrl/Alt etc. Given that there'sImGuiIO::KeySuper
, I don't think they'll be necessary either.EDIT: looks like I touched a couple more files than I was supposed to, deleted a bunch of trailing spaces which probably doesn't hurt anyone.