From e93c266647e0d828459911a0999f342a975158b6 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Tue, 13 Jan 2009 17:52:38 +0000 Subject: [PATCH] [clutter-text] Don't allow control characters to be inserted If an unbound control key is pressed (such as Ctrl+R) it would insert a rectangle into the text. Also zero is considered a valid unicode character by g_unichar_validate so pressing a key such as shift would cause the current selection to be deleted. The character isn't actually inserted because insert_unichar disallows zeroes. --- clutter/clutter-text.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 76721a6d2..c5f51773c 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -1017,7 +1017,9 @@ clutter_text_key_press (ClutterActor *actor, if (key_unichar == '\r') key_unichar = '\n'; - if (g_unichar_validate (key_unichar)) + if (key_unichar == '\n' || + (g_unichar_validate (key_unichar) && + !g_unichar_iscntrl (key_unichar))) { /* truncate the eventual selection so that the * Unicode character can replace it