[Bf-blender-cvs] [701a4a4] master: Fix cmd+z for undo not working when editing text objects on OS X.

Brecht Van Lommel noreply at git.blender.org
Sat Feb 13 22:54:43 CET 2016


Commit: 701a4a4e09343cc57d53a8767e609cf8da2ec945
Author: Brecht Van Lommel
Date:   Sat Feb 13 21:07:32 2016 +0100
Branches: master
https://developer.blender.org/rB701a4a4e09343cc57d53a8767e609cf8da2ec945

Fix cmd+z for undo not working when editing text objects on OS X.

===================================================================

M	intern/ghost/intern/GHOST_SystemCocoa.mm

===================================================================

diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 73d5012..4db945d 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1548,11 +1548,6 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
 				for (int x = 0; x < [convertedCharacters length]; x++) {
 					utf8_buf[x] = ((char*)[convertedCharacters bytes])[x];
 				}
-
-				/* ascii is a subset of unicode */
-				if ([convertedCharacters length] == 1) {
-					ascii = utf8_buf[0];
-				}
 			}
 
 			/* arrow keys should not have utf8 */
@@ -1570,6 +1565,11 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
 			if ((keyCode == GHOST_kKeyQ) && (m_modifierMask & NSCommandKeyMask))
 				break; //Cmd-Q is directly handled by Cocoa
 
+			/* ascii is a subset of unicode */
+			if (utf8_buf[0] && !utf8_buf[1]) {
+				ascii = utf8_buf[0];
+			}
+
 			if ([event type] == NSKeyDown) {
 				pushEvent( new GHOST_EventKey([event timestamp] * 1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) );
 				//printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);




More information about the Bf-blender-cvs mailing list