-
Notifications
You must be signed in to change notification settings - Fork 567
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
IME integration (and a new TextBox widget) #1636
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Mar 6, 2021
cmyr
force-pushed
the
ime-integration
branch
2 times, most recently
from
March 10, 2021 20:40
e83d3ce
to
2c29bc0
Compare
This is a rollup of a bunch of messy work exploring IME integration. Ime progress: make simple editor widget, do some invalidiation This doesn't do invalidation when the document changes, but it does invalidation when the selection changes? wip getting a little closer? Add examples/textbox, get multiline and scroll_to working This adds a new example for displaying textbox config options, and gets multiline working with a clip view, with scrolling to display new text on return. Embed TextBox in a Scroll widget This now 'just works' with vertical scrolling, only showing scrollbars when it makes sense. TextBox text alignment is working again Manually clip placeholder text in TextBox Rename types and fixup docs Textbox scroll fixups - dragging the selection causes scroll - only do scroll_to with a larger rect if the target is not visible.
This is a rollup of a bunch of checkpoint commits while I was getting the textboxes working with IME again. Input editor uses notifications to communicate return/cancel/tab This lets the widget using the editor to have more control over behaviour; it also makes it possible to handle return/escape without breaking an IME session. Get ValueTextBox working again This still some issues around invalidation, but it's... *mostly* working. It feels really fragile. Delete old textbox impl TextBox, not component, is responsible for managing focus This moves to making the component much 'dumber', and lets more higher-level logic be handled in higher-level widgets. Communicate invalidation state with the platform. During event handling, the SharedTextComponent tracks invalidation state; after update the user of the component checks for this state and invalidates with the platform if needed. Only request a cursor timer when we have focus This fixes a long standing issue any textbox that had ever had focus would continue requesting timers until the end of time. Stash external selection changes and apply them when updating text This fixes an issue where the ValueTextBox would not be able to determine when the selection had changed during editing. Fixup tests Remove old editing code File and type renames This tries to move a bunch of types into the right files, and moves those files into the right modules, with meaningful names. ValueTextBox moves to value_textbox.rs ime_textbox.rs moves to textbox.rs ImeTextBox renamed to TextBox ImeHandlerRef and TextFieldRegistration moved to text/input_methods.rs ime_handler.rs moved to input_component.rs SharedTextComponent -> TextComponent Fixup broken doc links Simplify examples/textbox.rs This also adds menus so we can play with copy/paste etc. Get paste/copy/cut working again This gets us back to parity with the current situation, but I'd like to get these working without menus soon.
- Make invalidate_text_field not take an Option - Use WidgetWrapper for Padding - remove some unused code - Other small doc fixes - Add TextBox example to web examples
16 tasks
Okay I've opened #1652 to track follow-up work, let's see what breaks? |
This was referenced Aug 12, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a big rollup of work on integrating platform text input APIs into druid.
It is based on (and currently includes commits from) #1619. It also includes commits from a number of other smaller PRs, such as #1630, #1634, and #1635.
Input methods
The highlight of this work is that the textbox is now designed to work with platform text input APIs. Currently these are only supported on macOS; there is a very simple shim in place for other platforms, so that they should continue to work as before.
Screen.Recording.2021-03-05.at.4.31.04.PM.mov
Screen.Recording.2021-03-05.at.4.49.44.PM.mov
There are various little bugs to be worked out here (the size of the text seems to jump around, the position of the text isn't always reported correctly) but overall I think it's good enough to merge.
Textbox changes
As this work involved ripping everything out anyway, I decided to overhaul the textbox. In particular the textbox now uses a normal
Scroll
widget internally to manage text-position, instead of having its own custom clip/hscroll code. A major benefit of this change is that the multi-line textbox is much better; it will grow vertically until it hits a constraint, and once it is constrained it will show sliders:Screen.Recording.2021-03-05.at.4.59.00.PM.mov
Known issues
My current plan is to get the other PRs merged, rebase this, and get it merged, more or less as-is. This will introduce some bugs, but we can address them individually instead of just trying to cram everything into here.
That said, there are some problems I'm aware of:
I'm sure more things will crop up over time.