[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.
This commit is contained in:
parent
de114dead7
commit
e93c266647
@ -1017,7 +1017,9 @@ clutter_text_key_press (ClutterActor *actor,
|
|||||||
if (key_unichar == '\r')
|
if (key_unichar == '\r')
|
||||||
key_unichar = '\n';
|
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
|
/* truncate the eventual selection so that the
|
||||||
* Unicode character can replace it
|
* Unicode character can replace it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user