diff --git a/docs/changelog.rst b/docs/changelog.rst index 72dcd3174..5d33d2c2e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -35,6 +35,9 @@ To update |kitty|, :doc:`follow the instructions `. - Fix window title for minimized windows not being updated (:iss:`1332`) +- macOS: Fix using multi-key sequences to input text ignoring the + first few key presses if the sequence is aborted (:iss:`1311`) + 0.13.3 [2019-01-19] ------------------------------ diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index fc6b65057..5352fc6d8 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -1033,7 +1033,9 @@ is_ascii_control_char(char x) { characters = [string string]; else characters = (NSString*) string; - snprintf(_glfw.ns.text, sizeof(_glfw.ns.text), "%s", [characters UTF8String]); + // insertText can be called multiple times for a single key event + char *s = _glfw.ns.text + strnlen(_glfw.ns.text, sizeof(_glfw.ns.text)); + snprintf(s, sizeof(_glfw.ns.text) - (s - _glfw.ns.text), "%s", [characters UTF8String]); _glfw.ns.text[sizeof(_glfw.ns.text) - 1] = 0; }