diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index e2aea94fa..13756cc3c 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -144,6 +144,8 @@ { [_markedText release]; _markedText = nil; + + SDL_SendEditingText("", 0, 0); } - (NSRect) firstRectForCharacterRange: (NSRange) theRange diff --git a/test/testime.c b/test/testime.c index 6975d652d..c2b5b045f 100644 --- a/test/testime.c +++ b/test/testime.c @@ -136,11 +136,13 @@ static void RenderText(SDL_Surface *sur, int x, int y, SDL_Color color) { - SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, color); - SDL_Rect dest = { x, y, textSur->w, textSur->h }; + if (text && strlen(text)) { + SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, color); + SDL_Rect dest = { x, y, textSur->w, textSur->h }; - SDL_BlitSurface(textSur, NULL, sur, &dest); - SDL_FreeSurface(textSur); + SDL_BlitSurface(textSur, NULL, sur, &dest); + SDL_FreeSurface(textSur); + } } #endif