IME: Render overlay at the last visible cursor position and improvements under macOS #6049
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.
Render overlay at the last visible cursor position with a separate cursor.
Fix the problem caused by wrong cursor coordinates. No more messing with the main cursor, instead the cursor is saved when receiving a pre-edit text update and used for drawing later.
Update the overlay to the last visible cursor position before rendering to ensure it always moves with the cursor. Finally, draw the overlay after line rendering is complete, and restore the line buffer after updating the rendered data to ensure that the line text being read is correct at all times.
This also improves performance by only rendering once when changes are made, eliminating the need to repeatedly disable and draw after various commands and not even comprehensively.
Allow IME to actively get the cursor position in real time on macOS.
IME will automatically get the display position when needed, which keeps it consistent with the overlay as much as possible.
Fix the issue that when IME is activated after mouse click, it is displayed at the wrong position.
After the window is created, the initial activation of the IME will be in whatever position the cursor is located, not in the upper left corner.
Tested on:
Supersedes:
#6002
Please review, thank you.