mirror of
https://github.com/brl/mutter.git
synced 2025-04-15 22:59:40 +00:00
Truncate selections on text insertion
When inserting text on a key press event we should also truncate the selection. We should not truncate the selection when inserting any Unicode character, since changing the selection also changes the cursor position - and one of the invariants we inherited from ClutterEntry is that inserting characters programmatically does not change the cursor position.
This commit is contained in:
parent
35172a7615
commit
f13e00b411
@ -898,7 +898,8 @@ static gboolean
|
|||||||
clutter_text_key_press (ClutterActor *actor,
|
clutter_text_key_press (ClutterActor *actor,
|
||||||
ClutterKeyEvent *event)
|
ClutterKeyEvent *event)
|
||||||
{
|
{
|
||||||
ClutterTextPrivate *priv = CLUTTER_TEXT (actor)->priv;
|
ClutterText *self = CLUTTER_TEXT (actor);
|
||||||
|
ClutterTextPrivate *priv = self->priv;
|
||||||
ClutterBindingPool *pool;
|
ClutterBindingPool *pool;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
gint keyval;
|
gint keyval;
|
||||||
@ -925,7 +926,8 @@ clutter_text_key_press (ClutterActor *actor,
|
|||||||
|
|
||||||
if (g_unichar_validate (key_unichar))
|
if (g_unichar_validate (key_unichar))
|
||||||
{
|
{
|
||||||
clutter_text_insert_unichar (CLUTTER_TEXT (actor), key_unichar);
|
clutter_text_truncate_selection (self);
|
||||||
|
clutter_text_insert_unichar (self, key_unichar);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user