Browse Source

Unprintable ascii text (numbers 0-31 and 127 in decimal) is no longer sent to the unicode argument of love.keypressed

Alex Szpakowski 12 years ago
parent
commit
295487165f
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/modules/event/sdl/Event.cpp

+ 2 - 1
src/modules/event/sdl/Event.cpp

@@ -103,7 +103,8 @@ Message *Event::convert(SDL_Event &e)
 			txt = "unknown";
 			txt = "unknown";
 		arg1 = new Variant(txt, strlen(txt));
 		arg1 = new Variant(txt, strlen(txt));
 		txt = convertUnicode(e.key.keysym.unicode);
 		txt = convertUnicode(e.key.keysym.unicode);
-		if (txt)
+		// We don't want to send unprintable unicode text.
+		if (txt && (txt[0] >= ' ' && txt[0] != 127))
 		{
 		{
 			arg2 = new Variant(txt, strlen(txt));
 			arg2 = new Variant(txt, strlen(txt));
 			msg = new Message("keypressed", arg1, arg2);
 			msg = new Message("keypressed", arg1, arg2);