mirror of
https://github.com/brl/mutter.git
synced 2025-03-25 04:33:52 +00:00
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);
|
layout = clutter_text_get_layout (self);
|
||||||
|
|
||||||
pango_layout_index_to_line_x (layout,
|
if (priv->position == 0)
|
||||||
offset_to_bytes (priv->text, priv->position),
|
index_ = 0;
|
||||||
|
else
|
||||||
|
index_ = offset_to_bytes (priv->text, priv->position);
|
||||||
|
|
||||||
|
pango_layout_index_to_line_x (layout, index_,
|
||||||
0,
|
0,
|
||||||
&line_no, &x);
|
&line_no, &x);
|
||||||
|
|
||||||
|
line_no -= 1;
|
||||||
|
if (line_no < 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (priv->x_pos != -1)
|
if (priv->x_pos != -1)
|
||||||
x = priv->x_pos;
|
x = priv->x_pos;
|
||||||
else
|
else
|
||||||
priv->x_pos = x;
|
priv->x_pos = x;
|
||||||
|
|
||||||
line_no -= 1;
|
|
||||||
if (line_no < 0)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
layout_line = pango_layout_get_line_readonly (layout, line_no);
|
layout_line = pango_layout_get_line_readonly (layout, line_no);
|
||||||
if (!layout_line)
|
if (!layout_line)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1256,8 +1260,12 @@ clutter_text_real_move_down (ClutterText *self,
|
|||||||
|
|
||||||
layout = clutter_text_get_layout (self);
|
layout = clutter_text_get_layout (self);
|
||||||
|
|
||||||
pango_layout_index_to_line_x (layout,
|
if (priv->position == 0)
|
||||||
offset_to_bytes (priv->text, priv->position),
|
index_ = 0;
|
||||||
|
else
|
||||||
|
index_ = offset_to_bytes (priv->text, priv->position);
|
||||||
|
|
||||||
|
pango_layout_index_to_line_x (layout, index_,
|
||||||
0,
|
0,
|
||||||
&line_no, &x);
|
&line_no, &x);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user