Fix for deleting the last uncommit character
authorJjgod Jiang <gzjjgod@gmail.com>
Thu, 12 Aug 2010 16:00:47 +0200
changeset 46378c229370ddba
parent 4636 b196d2758026
child 4638 08d22c54a21f
Fix for deleting the last uncommit character
src/video/cocoa/SDL_cocoakeyboard.m
test/testime.c
     1.1 --- a/src/video/cocoa/SDL_cocoakeyboard.m	Mon Aug 16 09:04:55 2010 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoakeyboard.m	Thu Aug 12 16:00:47 2010 +0200
     1.3 @@ -144,6 +144,8 @@
     1.4  {
     1.5      [_markedText release];
     1.6      _markedText = nil;
     1.7 +
     1.8 +    SDL_SendEditingText("", 0, 0);
     1.9  }
    1.10  
    1.11  - (NSRect) firstRectForCharacterRange: (NSRange) theRange
     2.1 --- a/test/testime.c	Mon Aug 16 09:04:55 2010 -0700
     2.2 +++ b/test/testime.c	Thu Aug 12 16:00:47 2010 +0200
     2.3 @@ -136,11 +136,13 @@
     2.4                          int x, int y,
     2.5                          SDL_Color color)
     2.6  {
     2.7 -    SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, color);
     2.8 -    SDL_Rect dest = { x, y, textSur->w, textSur->h };
     2.9 +    if (text && strlen(text)) {
    2.10 +        SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, color);
    2.11 +        SDL_Rect dest = { x, y, textSur->w, textSur->h };
    2.12  
    2.13 -    SDL_BlitSurface(textSur, NULL, sur, &dest);
    2.14 -    SDL_FreeSurface(textSur);
    2.15 +        SDL_BlitSurface(textSur, NULL, sur, &dest);
    2.16 +        SDL_FreeSurface(textSur);
    2.17 +    }
    2.18  }
    2.19  #endif
    2.20