Handle the case of querying the format when cursor position equals the length
of the text. SVN revision: 13599
This commit is contained in:
parent
b1c95faae0
commit
84c148adf6
|
@ -1623,27 +1623,24 @@ evas_object_textblock_node_pos_get(Evas_Object *obj, int pos, int *pstart)
|
||||||
{
|
{
|
||||||
Evas_Object_Textblock *o;
|
Evas_Object_Textblock *o;
|
||||||
Evas_Object_List *l;
|
Evas_Object_List *l;
|
||||||
int p, ps;
|
int p, ps = 0;
|
||||||
|
Node *node = NULL;
|
||||||
|
|
||||||
o = (Evas_Object_Textblock *)(obj->object_data);
|
o = (Evas_Object_Textblock *)(obj->object_data);
|
||||||
ps = p = 0;
|
ps = p = 0;
|
||||||
for (l = (Evas_Object_List *)o->nodes; l; l = l->next)
|
for (l = (Evas_Object_List *)o->nodes; l; l = l->next)
|
||||||
{
|
{
|
||||||
Node *node;
|
|
||||||
|
|
||||||
node = (Node *)l;
|
node = (Node *)l;
|
||||||
if (node->text)
|
if (node->text)
|
||||||
{
|
{
|
||||||
ps = p;
|
ps = p;
|
||||||
p += node->text_len;
|
p += node->text_len;
|
||||||
if (p > pos)
|
if (p > pos) break;
|
||||||
{
|
|
||||||
*pstart = ps;
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
*pstart = ps;
|
||||||
|
if (node && !node->text) node = NULL;
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Layout_Node *
|
static Layout_Node *
|
||||||
|
@ -1651,26 +1648,27 @@ evas_object_textblock_layout_node_pos_get(Evas_Object *obj, int pos, int *pstart
|
||||||
{
|
{
|
||||||
Evas_Object_Textblock *o;
|
Evas_Object_Textblock *o;
|
||||||
Evas_Object_List *l;
|
Evas_Object_List *l;
|
||||||
int p;
|
int p = 0;
|
||||||
|
Layout_Node *lnode = NULL;
|
||||||
|
|
||||||
o = (Evas_Object_Textblock *)(obj->object_data);
|
o = (Evas_Object_Textblock *)(obj->object_data);
|
||||||
p = 0;
|
p = 0;
|
||||||
for (l = (Evas_Object_List *)o->layout_nodes; l; l = l->next)
|
for (l = (Evas_Object_List *)o->layout_nodes; l; l = l->next)
|
||||||
{
|
{
|
||||||
Layout_Node *lnode;
|
|
||||||
|
|
||||||
lnode = (Layout_Node *)l;
|
lnode = (Layout_Node *)l;
|
||||||
if (lnode->text)
|
if (lnode->text)
|
||||||
{
|
{
|
||||||
p = lnode->text_pos + lnode->text_len;
|
p = lnode->text_pos + lnode->text_len;
|
||||||
if (p > pos)
|
if (p > pos)
|
||||||
{
|
{
|
||||||
*pstart = lnode->text_pos;
|
p = lnode->text_pos;
|
||||||
return lnode;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
*pstart = p;
|
||||||
|
if (lnode && !lnode->text) lnode = NULL;
|
||||||
|
return lnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unused */
|
/* unused */
|
||||||
|
|
Loading…
Reference in New Issue