Fix cursor position in preedit status
http://bugzilla.openedhand.com/show_bug.cgi?id=1871 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
parent
7e17822cfd
commit
bc51b8ca47
@ -590,13 +590,19 @@ clutter_text_position_to_coords (ClutterText *self,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
gchar *text = clutter_text_get_display_text (self);
|
gchar *text = clutter_text_get_display_text (self);
|
||||||
|
GString *tmp = g_string_new (text);
|
||||||
|
gint cursor_index;
|
||||||
|
|
||||||
|
cursor_index = offset_to_bytes (text, priv->position);
|
||||||
|
g_string_insert (tmp, cursor_index, priv->preedit_str);
|
||||||
|
|
||||||
if (priv->password_char == 0)
|
if (priv->password_char == 0)
|
||||||
index_ = offset_to_bytes (text, position);
|
index_ = offset_to_bytes (tmp->str, position);
|
||||||
else
|
else
|
||||||
index_ = position * password_char_bytes;
|
index_ = position * password_char_bytes;
|
||||||
|
|
||||||
g_free (text);
|
g_free (text);
|
||||||
|
g_string_free (tmp, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pango_layout_get_cursor_pos (clutter_text_get_layout (self),
|
pango_layout_get_cursor_pos (clutter_text_get_layout (self),
|
||||||
@ -634,7 +640,11 @@ clutter_text_ensure_cursor_position (ClutterText *self)
|
|||||||
position = priv->position;
|
position = priv->position;
|
||||||
|
|
||||||
if (priv->editable && priv->preedit_set)
|
if (priv->editable && priv->preedit_set)
|
||||||
|
{
|
||||||
|
if (position == -1)
|
||||||
|
position = priv->n_chars;
|
||||||
position += priv->preedit_cursor_pos;
|
position += priv->preedit_cursor_pos;
|
||||||
|
}
|
||||||
|
|
||||||
CLUTTER_NOTE (MISC, "Cursor at %d (preedit %s at pos: %d)",
|
CLUTTER_NOTE (MISC, "Cursor at %d (preedit %s at pos: %d)",
|
||||||
position,
|
position,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user