Tell cocoa the previous character range is invalid when updating IME position

Without this IME popup position is sometimes incorrect, for instance, at
startup
This commit is contained in:
Kovid Goyal 2021-11-28 22:11:21 +05:30
parent 5e78b1c23e
commit acdf06bf5d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1505,12 +1505,13 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
top /= window->ns.yscale;
cellWidth /= window->ns.xscale;
cellHeight /= window->ns.yscale;
debug_key("updateIMEState: left=%f, top=%f, width=%f, height=%f\n", left, top, cellWidth, cellHeight);
debug_key("updateIMEPosition: left=%f, top=%f, width=%f, height=%f\n", left, top, cellWidth, cellHeight);
const NSRect frame = [window->ns.view frame];
const NSRect rectInView = NSMakeRect(left,
frame.size.height - top - cellHeight,
cellWidth, cellHeight);
markedRect = [window->ns.object convertRectToScreen: rectInView];
if (_glfwPlatformWindowFocused(window)) [[window->ns.view inputContext] invalidateCharacterCoordinates];
}
- (NSArray*)validAttributesForMarkedText