Fix up/down key navigation
The behaviour of ClutterText around the initial position is still a little bit erratic. This commit fixes the key navigation with Up and Down arrows around the first line of text.
This commit is contained in:
parent
e615b8cc6b
commit
be64cbcdc2
@ -1209,20 +1209,24 @@ clutter_text_real_move_up (ClutterText *self,
|
||||
|
||||
layout = clutter_text_get_layout (self);
|
||||
|
||||
pango_layout_index_to_line_x (layout,
|
||||
offset_to_bytes (priv->text, priv->position),
|
||||
if (priv->position == 0)
|
||||
index_ = 0;
|
||||
else
|
||||
index_ = offset_to_bytes (priv->text, priv->position);
|
||||
|
||||
pango_layout_index_to_line_x (layout, index_,
|
||||
0,
|
||||
&line_no, &x);
|
||||
|
||||
line_no -= 1;
|
||||
if (line_no < 0)
|
||||
return FALSE;
|
||||
|
||||
if (priv->x_pos != -1)
|
||||
x = priv->x_pos;
|
||||
else
|
||||
priv->x_pos = x;
|
||||
|
||||
line_no -= 1;
|
||||
if (line_no < 0)
|
||||
return FALSE;
|
||||
|
||||
layout_line = pango_layout_get_line_readonly (layout, line_no);
|
||||
if (!layout_line)
|
||||
return FALSE;
|
||||
@ -1256,8 +1260,12 @@ clutter_text_real_move_down (ClutterText *self,
|
||||
|
||||
layout = clutter_text_get_layout (self);
|
||||
|
||||
pango_layout_index_to_line_x (layout,
|
||||
offset_to_bytes (priv->text, priv->position),
|
||||
if (priv->position == 0)
|
||||
index_ = 0;
|
||||
else
|
||||
index_ = offset_to_bytes (priv->text, priv->position);
|
||||
|
||||
pango_layout_index_to_line_x (layout, index_,
|
||||
0,
|
||||
&line_no, &x);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user