Instead of calling insertText duplicate some of its code so we arent limited in the size of text we can insert

This commit is contained in:
Kovid Goyal 2023-01-29 19:49:50 +05:30
parent 9b5034f904
commit 18fc8dad37
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1617,7 +1617,16 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
}
if (text && [text length] > 0) {
// Terminal.app inserts the output, do the same
[self insertText:text replacementRange:NSMakeRange(0, [markedText length])];
const char *utf8 = polymorphic_string_as_utf8(text);
if ([self hasMarkedText]) {
[self unmarkText];
debug_key("Clearing pre-edit because insertText called from readSelectionFromPasteboard\n");
GLFWkeyevent glfw_keyevent = {.ime_state = GLFW_IME_PREEDIT_CHANGED};
_glfwInputKeyboard(window, &glfw_keyevent);
}
debug_key("Sending text received in readSelectionFromPasteboard as key event\n");
GLFWkeyevent glfw_keyevent = {.text=utf8};
_glfwInputKeyboard(window, &glfw_keyevent);
return YES;
}
return NO;