forked from enlightenment/efl
There's more here than just warning fixes, it's causing crashes with some uses of elm_entry. Noted in Editje.
SVN revision: 44639
This commit is contained in:
parent
9dc9b03db9
commit
83a91a9ab9
|
@ -163,8 +163,6 @@ static void evas_object_textblock_coords_recalc(Evas_Object *obj);
|
||||||
|
|
||||||
static void evas_object_textblock_scale_update(Evas_Object *obj);
|
static void evas_object_textblock_scale_update(Evas_Object *obj);
|
||||||
|
|
||||||
static void evas_object_textblock_text_markup_rebuild(Evas_Object_Textblock *o);
|
|
||||||
|
|
||||||
static const Evas_Object_Func object_func =
|
static const Evas_Object_Func object_func =
|
||||||
{
|
{
|
||||||
/* methods (compulsory) */
|
/* methods (compulsory) */
|
||||||
|
@ -227,161 +225,6 @@ static const Evas_Object_Func object_func =
|
||||||
* @ingroup Evas_Object_Specific
|
* @ingroup Evas_Object_Specific
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* table of html escapes (that i can find) this should be ordered with the
|
|
||||||
* most common first as it's a linear search to match - no hash for this.
|
|
||||||
*
|
|
||||||
* these are stored as one large string and one additional array that
|
|
||||||
* contains the offsets to the tokens for space efficiency.
|
|
||||||
*/
|
|
||||||
static const char escape_strings[] =
|
|
||||||
/* most common escaped stuff */
|
|
||||||
" \0" "\x20\0" /* NOTE: this here to avoid escaping to   */
|
|
||||||
" \0" "\x20\0" /* NOTE: we allow nsbp's to break as we map early - maybe map to ascii 0x01 and then make the rendering code think 0x01 -> 0x20 */
|
|
||||||
""\0" "\x22\0"
|
|
||||||
"&\0" "\x26\0"
|
|
||||||
"<\0" "\x3c\0"
|
|
||||||
">\0" "\x3e\0"
|
|
||||||
/* all the rest */
|
|
||||||
"¡\0" "\xc2\xa1\0"
|
|
||||||
"¢\0" "\xc2\xa2\0"
|
|
||||||
"£\0" "\xc2\xa3\0"
|
|
||||||
"¤\0" "\xc2\xa4\0"
|
|
||||||
"¥\0" "\xc2\xa5\0"
|
|
||||||
"¦\0" "\xc2\xa6\0"
|
|
||||||
"§\0" "\xc2\xa7\0"
|
|
||||||
"¨\0" "\xc2\xa8\0"
|
|
||||||
"©\0" "\xc2\xa9\0"
|
|
||||||
"ª\0" "\xc2\xaa\0"
|
|
||||||
"«\0" "\xc2\xab\0"
|
|
||||||
"¬\0" "\xc2\xac\0"
|
|
||||||
"®\0" "\xc2\xae\0"
|
|
||||||
"¯\0" "\xc2\xaf\0"
|
|
||||||
"°\0" "\xc2\xb0\0"
|
|
||||||
"±\0" "\xc2\xb1\0"
|
|
||||||
"²\0" "\xc2\xb2\0"
|
|
||||||
"³\0" "\xc2\xb3\0"
|
|
||||||
"´\0" "\xc2\xb4\0"
|
|
||||||
"µ\0" "\xc2\xb5\0"
|
|
||||||
"¶\0" "\xc2\xb6\0"
|
|
||||||
"·\0" "\xc2\xb7\0"
|
|
||||||
"¸\0" "\xc2\xb8\0"
|
|
||||||
"¹\0" "\xc2\xb9\0"
|
|
||||||
"º\0" "\xc2\xba\0"
|
|
||||||
"»\0" "\xc2\xbb\0"
|
|
||||||
"¼\0" "\xc2\xbc\0"
|
|
||||||
"½\0" "\xc2\xbd\0"
|
|
||||||
"¾\0" "\xc2\xbe\0"
|
|
||||||
"¿\0" "\xc2\xbf\0"
|
|
||||||
"À\0" "\xc3\x80\0"
|
|
||||||
"Á\0" "\xc3\x81\0"
|
|
||||||
"Â\0" "\xc3\x82\0"
|
|
||||||
"Ã\0" "\xc3\x83\0"
|
|
||||||
"Ä\0" "\xc3\x84\0"
|
|
||||||
"Å\0" "\xc3\x85\0"
|
|
||||||
"&Aelig;\0" "\xc3\x86\0"
|
|
||||||
"Ç\0" "\xc3\x87\0"
|
|
||||||
"È\0" "\xc3\x88\0"
|
|
||||||
"É\0" "\xc3\x89\0"
|
|
||||||
"Ê\0" "\xc3\x8a\0"
|
|
||||||
"Ë\0" "\xc3\x8b\0"
|
|
||||||
"È\0" "\xc3\x8c\0"
|
|
||||||
"É\0" "\xc3\x8d\0"
|
|
||||||
"Î\0" "\xc3\x8e\0"
|
|
||||||
"Ï\0" "\xc3\x8f\0"
|
|
||||||
"&Eth;\0" "\xc3\x90\0"
|
|
||||||
"Ñ\0" "\xc3\x91\0"
|
|
||||||
"Ò\0" "\xc3\x92\0"
|
|
||||||
"Ó\0" "\xc3\x93\0"
|
|
||||||
"Ô\0" "\xc3\x94\0"
|
|
||||||
"Õ\0" "\xc3\x95\0"
|
|
||||||
"Ö\0" "\xc3\x96\0"
|
|
||||||
"×\0" "\xc3\x97\0"
|
|
||||||
"Ø\0" "\xc3\x98\0"
|
|
||||||
"Ù\0" "\xc3\x99\0"
|
|
||||||
"Ú\0" "\xc3\x9a\0"
|
|
||||||
"Û\0" "\xc3\x9b\0"
|
|
||||||
"Ý\0" "\xc3\x9d\0"
|
|
||||||
"&Thorn;\0" "\xc3\x9e\0"
|
|
||||||
"ß\0" "\xc3\x9f\0"
|
|
||||||
"à\0" "\xc3\xa0\0"
|
|
||||||
"á\0" "\xc3\xa1\0"
|
|
||||||
"â\0" "\xc3\xa2\0"
|
|
||||||
"ã\0" "\xc3\xa3\0"
|
|
||||||
"ä\0" "\xc3\xa4\0"
|
|
||||||
"å\0" "\xc3\xa5\0"
|
|
||||||
"æ\0" "\xc3\xa6\0"
|
|
||||||
"ç\0" "\xc3\xa7\0"
|
|
||||||
"è\0" "\xc3\xa8\0"
|
|
||||||
"é\0" "\xc3\xa9\0"
|
|
||||||
"ê\0" "\xc3\xaa\0"
|
|
||||||
"ë\0" "\xc3\xab\0"
|
|
||||||
"ì\0" "\xc3\xac\0"
|
|
||||||
"í\0" "\xc3\xad\0"
|
|
||||||
"î\0" "\xc3\xae\0"
|
|
||||||
"ï\0" "\xc3\xaf\0"
|
|
||||||
"ð\0" "\xc3\xb0\0"
|
|
||||||
"ñ\0" "\xc3\xb1\0"
|
|
||||||
"ò\0" "\xc3\xb2\0"
|
|
||||||
"ó\0" "\xc3\xb3\0"
|
|
||||||
"ô\0" "\xc3\xb4\0"
|
|
||||||
"õ\0" "\xc3\xb5\0"
|
|
||||||
"ö\0" "\xc3\xb6\0"
|
|
||||||
"÷\0" "\xc3\xb7\0"
|
|
||||||
"ø\0" "\xc3\xb8\0"
|
|
||||||
"ù\0" "\xc3\xb9\0"
|
|
||||||
"ú\0" "\xc3\xba\0"
|
|
||||||
"û\0" "\xc3\xbb\0"
|
|
||||||
"ü\0" "\xc3\xbc\0"
|
|
||||||
"ý\0" "\xc3\xbd\0"
|
|
||||||
"þ\0" "\xc3\xbe\0"
|
|
||||||
"ÿ\0" "\xc3\xbf\0"
|
|
||||||
"α\0" "\xce\x91\0"
|
|
||||||
"β\0" "\xce\x92\0"
|
|
||||||
"γ\0" "\xce\x93\0"
|
|
||||||
"δ\0" "\xce\x94\0"
|
|
||||||
"ε\0" "\xce\x95\0"
|
|
||||||
"ζ\0" "\xce\x96\0"
|
|
||||||
"η\0" "\xce\x97\0"
|
|
||||||
"θ\0" "\xce\x98\0"
|
|
||||||
"ι\0" "\xce\x99\0"
|
|
||||||
"κ\0" "\xce\x9a\0"
|
|
||||||
"λ\0" "\xce\x9b\0"
|
|
||||||
"μ\0" "\xce\x9c\0"
|
|
||||||
"ν\0" "\xce\x9d\0"
|
|
||||||
"ξ\0" "\xce\x9e\0"
|
|
||||||
"ο\0" "\xce\x9f\0"
|
|
||||||
"π\0" "\xce\xa0\0"
|
|
||||||
"ρ\0" "\xce\xa1\0"
|
|
||||||
"σ\0" "\xce\xa3\0"
|
|
||||||
"τ\0" "\xce\xa4\0"
|
|
||||||
"υ\0" "\xce\xa5\0"
|
|
||||||
"φ\0" "\xce\xa6\0"
|
|
||||||
"χ\0" "\xce\xa7\0"
|
|
||||||
"ψ\0" "\xce\xa8\0"
|
|
||||||
"ω\0" "\xce\xa9\0"
|
|
||||||
"…\0" "\xe2\x80\xa6\0"
|
|
||||||
"€\0" "\xe2\x82\xac\0"
|
|
||||||
"←\0" "\xe2\x86\x90\0"
|
|
||||||
"↑\0" "\xe2\x86\x91\0"
|
|
||||||
"→\0" "\xe2\x86\x92\0"
|
|
||||||
"↓\0" "\xe2\x86\x93\0"
|
|
||||||
"↔\0" "\xe2\x86\x94\0"
|
|
||||||
"←\0" "\xe2\x87\x90\0"
|
|
||||||
"→\0" "\xe2\x87\x92\0"
|
|
||||||
"∀\0" "\xe2\x88\x80\0"
|
|
||||||
"∃\0" "\xe2\x88\x83\0"
|
|
||||||
"∇\0" "\xe2\x88\x87\0"
|
|
||||||
"∏\0" "\xe2\x88\x8f\0"
|
|
||||||
"∑\0" "\xe2\x88\x91\0"
|
|
||||||
"∧\0" "\xe2\x88\xa7\0"
|
|
||||||
"∨\0" "\xe2\x88\xa8\0"
|
|
||||||
"∫\0" "\xe2\x88\xab\0"
|
|
||||||
"≠\0" "\xe2\x89\xa0\0"
|
|
||||||
"≡\0" "\xe2\x89\xa1\0"
|
|
||||||
"⊕\0" "\xe2\x8a\x95\0"
|
|
||||||
"⊥\0" "\xe2\x8a\xa5\0"
|
|
||||||
;
|
|
||||||
|
|
||||||
/* styles */
|
/* styles */
|
||||||
static void
|
static void
|
||||||
_style_clear(Evas_Textblock_Style *ts)
|
_style_clear(Evas_Textblock_Style *ts)
|
||||||
|
@ -637,87 +480,6 @@ _lines_clear(const Evas_Object *obj, Evas_Object_Textblock_Line *lines)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
|
||||||
_advance_after_end_of_string(const char **p_buf)
|
|
||||||
{
|
|
||||||
while (**p_buf != 0) (*p_buf)++;
|
|
||||||
(*p_buf)++;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
_is_eq_and_advance(const char *s, const char *s_end,
|
|
||||||
const char **p_m, const char *m_end)
|
|
||||||
{
|
|
||||||
for (;((s < s_end) && (*p_m < m_end)); s++, (*p_m)++)
|
|
||||||
{
|
|
||||||
if (*s != **p_m)
|
|
||||||
{
|
|
||||||
_advance_after_end_of_string(p_m);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*p_m < m_end)
|
|
||||||
_advance_after_end_of_string(p_m);
|
|
||||||
|
|
||||||
return s == s_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline const char *
|
|
||||||
_escaped_char_match(const char *s, int *adv)
|
|
||||||
{
|
|
||||||
const char *map_itr, *map_end, *mc, *sc;
|
|
||||||
|
|
||||||
map_itr = escape_strings;
|
|
||||||
map_end = map_itr + sizeof(escape_strings);
|
|
||||||
|
|
||||||
while (map_itr < map_end)
|
|
||||||
{
|
|
||||||
const char *escape;
|
|
||||||
int match;
|
|
||||||
|
|
||||||
escape = map_itr;
|
|
||||||
_advance_after_end_of_string(&map_itr);
|
|
||||||
if (map_itr >= map_end) break;
|
|
||||||
|
|
||||||
mc = map_itr;
|
|
||||||
sc = s;
|
|
||||||
match = 1;
|
|
||||||
while ((*mc) && (*sc))
|
|
||||||
{
|
|
||||||
if ((unsigned char)*sc < (unsigned char)*mc) return NULL;
|
|
||||||
if (*sc != *mc) match = 0;
|
|
||||||
mc++;
|
|
||||||
sc++;
|
|
||||||
}
|
|
||||||
if (match)
|
|
||||||
{
|
|
||||||
*adv = mc - map_itr;
|
|
||||||
return escape;
|
|
||||||
}
|
|
||||||
_advance_after_end_of_string(&map_itr);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline const char *
|
|
||||||
_escaped_char_get(const char *s, const char *s_end)
|
|
||||||
{
|
|
||||||
const char *map_itr, *map_end;
|
|
||||||
|
|
||||||
map_itr = escape_strings;
|
|
||||||
map_end = map_itr + sizeof(escape_strings);
|
|
||||||
|
|
||||||
while (map_itr < map_end)
|
|
||||||
{
|
|
||||||
if (_is_eq_and_advance(s, s_end, &map_itr, map_end))
|
|
||||||
return map_itr;
|
|
||||||
if (map_itr < map_end)
|
|
||||||
_advance_after_end_of_string(&map_itr);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_nodes_adjacent_merge(const Evas_Object *obj, Evas_Object_Textblock_Node *n1)
|
_nodes_adjacent_merge(const Evas_Object *obj, Evas_Object_Textblock_Node *n1)
|
||||||
{
|
{
|
||||||
|
@ -784,6 +546,162 @@ _nodes_adjacent_merge(const Evas_Object *obj, Evas_Object_Textblock_Node *n1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* table of html escapes (that i can find) this should be ordered with the
|
||||||
|
* most common first as it's a linear search to match - no hash for this.
|
||||||
|
*
|
||||||
|
* these are stored as one large string and one additional array that
|
||||||
|
* contains the offsets to the tokens for space efficiency.
|
||||||
|
*/
|
||||||
|
static const char escape_strings[] =
|
||||||
|
/* most common escaped stuff */
|
||||||
|
" \0" "\x20\0" /* NOTE: this here to avoid escaping to   */
|
||||||
|
" \0" "\x20\0" /* NOTE: we allow nsbp's to break as we map early - maybe map to ascii 0x01 and then make the rendering code think 0x01 -> 0x20 */
|
||||||
|
""\0" "\x22\0"
|
||||||
|
"&\0" "\x26\0"
|
||||||
|
"<\0" "\x3c\0"
|
||||||
|
">\0" "\x3e\0"
|
||||||
|
/* all the rest */
|
||||||
|
"¡\0" "\xc2\xa1\0"
|
||||||
|
"¢\0" "\xc2\xa2\0"
|
||||||
|
"£\0" "\xc2\xa3\0"
|
||||||
|
"¤\0" "\xc2\xa4\0"
|
||||||
|
"¥\0" "\xc2\xa5\0"
|
||||||
|
"¦\0" "\xc2\xa6\0"
|
||||||
|
"§\0" "\xc2\xa7\0"
|
||||||
|
"¨\0" "\xc2\xa8\0"
|
||||||
|
"©\0" "\xc2\xa9\0"
|
||||||
|
"ª\0" "\xc2\xaa\0"
|
||||||
|
"«\0" "\xc2\xab\0"
|
||||||
|
"¬\0" "\xc2\xac\0"
|
||||||
|
"®\0" "\xc2\xae\0"
|
||||||
|
"¯\0" "\xc2\xaf\0"
|
||||||
|
"°\0" "\xc2\xb0\0"
|
||||||
|
"±\0" "\xc2\xb1\0"
|
||||||
|
"²\0" "\xc2\xb2\0"
|
||||||
|
"³\0" "\xc2\xb3\0"
|
||||||
|
"´\0" "\xc2\xb4\0"
|
||||||
|
"µ\0" "\xc2\xb5\0"
|
||||||
|
"¶\0" "\xc2\xb6\0"
|
||||||
|
"·\0" "\xc2\xb7\0"
|
||||||
|
"¸\0" "\xc2\xb8\0"
|
||||||
|
"¹\0" "\xc2\xb9\0"
|
||||||
|
"º\0" "\xc2\xba\0"
|
||||||
|
"»\0" "\xc2\xbb\0"
|
||||||
|
"¼\0" "\xc2\xbc\0"
|
||||||
|
"½\0" "\xc2\xbd\0"
|
||||||
|
"¾\0" "\xc2\xbe\0"
|
||||||
|
"¿\0" "\xc2\xbf\0"
|
||||||
|
"À\0" "\xc3\x80\0"
|
||||||
|
"Á\0" "\xc3\x81\0"
|
||||||
|
"Â\0" "\xc3\x82\0"
|
||||||
|
"Ã\0" "\xc3\x83\0"
|
||||||
|
"Ä\0" "\xc3\x84\0"
|
||||||
|
"Å\0" "\xc3\x85\0"
|
||||||
|
"&Aelig;\0" "\xc3\x86\0"
|
||||||
|
"Ç\0" "\xc3\x87\0"
|
||||||
|
"È\0" "\xc3\x88\0"
|
||||||
|
"É\0" "\xc3\x89\0"
|
||||||
|
"Ê\0" "\xc3\x8a\0"
|
||||||
|
"Ë\0" "\xc3\x8b\0"
|
||||||
|
"È\0" "\xc3\x8c\0"
|
||||||
|
"É\0" "\xc3\x8d\0"
|
||||||
|
"Î\0" "\xc3\x8e\0"
|
||||||
|
"Ï\0" "\xc3\x8f\0"
|
||||||
|
"&Eth;\0" "\xc3\x90\0"
|
||||||
|
"Ñ\0" "\xc3\x91\0"
|
||||||
|
"Ò\0" "\xc3\x92\0"
|
||||||
|
"Ó\0" "\xc3\x93\0"
|
||||||
|
"Ô\0" "\xc3\x94\0"
|
||||||
|
"Õ\0" "\xc3\x95\0"
|
||||||
|
"Ö\0" "\xc3\x96\0"
|
||||||
|
"×\0" "\xc3\x97\0"
|
||||||
|
"Ø\0" "\xc3\x98\0"
|
||||||
|
"Ù\0" "\xc3\x99\0"
|
||||||
|
"Ú\0" "\xc3\x9a\0"
|
||||||
|
"Û\0" "\xc3\x9b\0"
|
||||||
|
"Ý\0" "\xc3\x9d\0"
|
||||||
|
"&Thorn;\0" "\xc3\x9e\0"
|
||||||
|
"ß\0" "\xc3\x9f\0"
|
||||||
|
"à\0" "\xc3\xa0\0"
|
||||||
|
"á\0" "\xc3\xa1\0"
|
||||||
|
"â\0" "\xc3\xa2\0"
|
||||||
|
"ã\0" "\xc3\xa3\0"
|
||||||
|
"ä\0" "\xc3\xa4\0"
|
||||||
|
"å\0" "\xc3\xa5\0"
|
||||||
|
"æ\0" "\xc3\xa6\0"
|
||||||
|
"ç\0" "\xc3\xa7\0"
|
||||||
|
"è\0" "\xc3\xa8\0"
|
||||||
|
"é\0" "\xc3\xa9\0"
|
||||||
|
"ê\0" "\xc3\xaa\0"
|
||||||
|
"ë\0" "\xc3\xab\0"
|
||||||
|
"ì\0" "\xc3\xac\0"
|
||||||
|
"í\0" "\xc3\xad\0"
|
||||||
|
"î\0" "\xc3\xae\0"
|
||||||
|
"ï\0" "\xc3\xaf\0"
|
||||||
|
"ð\0" "\xc3\xb0\0"
|
||||||
|
"ñ\0" "\xc3\xb1\0"
|
||||||
|
"ò\0" "\xc3\xb2\0"
|
||||||
|
"ó\0" "\xc3\xb3\0"
|
||||||
|
"ô\0" "\xc3\xb4\0"
|
||||||
|
"õ\0" "\xc3\xb5\0"
|
||||||
|
"ö\0" "\xc3\xb6\0"
|
||||||
|
"÷\0" "\xc3\xb7\0"
|
||||||
|
"ø\0" "\xc3\xb8\0"
|
||||||
|
"ù\0" "\xc3\xb9\0"
|
||||||
|
"ú\0" "\xc3\xba\0"
|
||||||
|
"û\0" "\xc3\xbb\0"
|
||||||
|
"ü\0" "\xc3\xbc\0"
|
||||||
|
"ý\0" "\xc3\xbd\0"
|
||||||
|
"þ\0" "\xc3\xbe\0"
|
||||||
|
"ÿ\0" "\xc3\xbf\0"
|
||||||
|
"α\0" "\xce\x91\0"
|
||||||
|
"β\0" "\xce\x92\0"
|
||||||
|
"γ\0" "\xce\x93\0"
|
||||||
|
"δ\0" "\xce\x94\0"
|
||||||
|
"ε\0" "\xce\x95\0"
|
||||||
|
"ζ\0" "\xce\x96\0"
|
||||||
|
"η\0" "\xce\x97\0"
|
||||||
|
"θ\0" "\xce\x98\0"
|
||||||
|
"ι\0" "\xce\x99\0"
|
||||||
|
"κ\0" "\xce\x9a\0"
|
||||||
|
"λ\0" "\xce\x9b\0"
|
||||||
|
"μ\0" "\xce\x9c\0"
|
||||||
|
"ν\0" "\xce\x9d\0"
|
||||||
|
"ξ\0" "\xce\x9e\0"
|
||||||
|
"ο\0" "\xce\x9f\0"
|
||||||
|
"π\0" "\xce\xa0\0"
|
||||||
|
"ρ\0" "\xce\xa1\0"
|
||||||
|
"σ\0" "\xce\xa3\0"
|
||||||
|
"τ\0" "\xce\xa4\0"
|
||||||
|
"υ\0" "\xce\xa5\0"
|
||||||
|
"φ\0" "\xce\xa6\0"
|
||||||
|
"χ\0" "\xce\xa7\0"
|
||||||
|
"ψ\0" "\xce\xa8\0"
|
||||||
|
"ω\0" "\xce\xa9\0"
|
||||||
|
"…\0" "\xe2\x80\xa6\0"
|
||||||
|
"€\0" "\xe2\x82\xac\0"
|
||||||
|
"←\0" "\xe2\x86\x90\0"
|
||||||
|
"↑\0" "\xe2\x86\x91\0"
|
||||||
|
"→\0" "\xe2\x86\x92\0"
|
||||||
|
"↓\0" "\xe2\x86\x93\0"
|
||||||
|
"↔\0" "\xe2\x86\x94\0"
|
||||||
|
"←\0" "\xe2\x87\x90\0"
|
||||||
|
"→\0" "\xe2\x87\x92\0"
|
||||||
|
"∀\0" "\xe2\x88\x80\0"
|
||||||
|
"∃\0" "\xe2\x88\x83\0"
|
||||||
|
"∇\0" "\xe2\x88\x87\0"
|
||||||
|
"∏\0" "\xe2\x88\x8f\0"
|
||||||
|
"∑\0" "\xe2\x88\x91\0"
|
||||||
|
"∧\0" "\xe2\x88\xa7\0"
|
||||||
|
"∨\0" "\xe2\x88\xa8\0"
|
||||||
|
"∫\0" "\xe2\x88\xab\0"
|
||||||
|
"≠\0" "\xe2\x89\xa0\0"
|
||||||
|
"≡\0" "\xe2\x89\xa1\0"
|
||||||
|
"⊕\0" "\xe2\x8a\x95\0"
|
||||||
|
"⊥\0" "\xe2\x8a\xa5\0"
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_is_white(int c)
|
_is_white(int c)
|
||||||
{
|
{
|
||||||
|
@ -1932,7 +1850,7 @@ _layout_text_append(Ctxt *c, Evas_Object_Textblock_Format *fmt, Evas_Object_Text
|
||||||
int i, len, chlen;
|
int i, len, chlen;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
len = evas_common_font_utf8_get_len((unsigned char *) n->text);
|
len = evas_common_font_utf8_get_len(n->text);
|
||||||
chlen = strlen(repch);
|
chlen = strlen(repch);
|
||||||
str = alloca((len * chlen) + 1);
|
str = alloca((len * chlen) + 1);
|
||||||
tbase = str;
|
tbase = str;
|
||||||
|
@ -2392,7 +2310,7 @@ _find_layout_item_line_match(Evas_Object *obj, Evas_Object_Textblock_Node *n, in
|
||||||
{
|
{
|
||||||
int pos2 = pos;
|
int pos2 = pos;
|
||||||
|
|
||||||
evas_common_font_utf8_get_prev((unsigned char *) n->text, &pos2);
|
evas_common_font_utf8_get_prev(n->text, &pos2);
|
||||||
if (pos2 < pos) pos = pos2;
|
if (pos2 < pos) pos = pos2;
|
||||||
}
|
}
|
||||||
EINA_INLIST_FOREACH(o->lines, ln)
|
EINA_INLIST_FOREACH(o->lines, ln)
|
||||||
|
@ -2472,71 +2390,6 @@ _find_layout_line_num(const Evas_Object *obj, int line)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
evas_object_textblock_text_markup_rebuild(Evas_Object_Textblock *o)
|
|
||||||
{
|
|
||||||
Evas_Object_Textblock_Node *n;
|
|
||||||
char *txt = NULL;
|
|
||||||
int txt_len = 0, txt_alloc = 0;
|
|
||||||
|
|
||||||
EINA_INLIST_FOREACH(o->nodes, n)
|
|
||||||
{
|
|
||||||
if ((n->type == NODE_FORMAT) && (n->text))
|
|
||||||
{
|
|
||||||
char *tag = _style_match_replace(o->style, n->text);
|
|
||||||
txt = _strbuf_append(txt, "<", &txt_len, &txt_alloc);
|
|
||||||
if (tag)
|
|
||||||
{
|
|
||||||
// FIXME: need to escape
|
|
||||||
txt = _strbuf_append(txt, tag, &txt_len, &txt_alloc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *s;
|
|
||||||
int push = 0;
|
|
||||||
int pop = 0;
|
|
||||||
|
|
||||||
// FIXME: need to escape
|
|
||||||
s = n->text;
|
|
||||||
if (*s == '+') push = 1;
|
|
||||||
if (*s == '-') pop = 1;
|
|
||||||
while ((*s == ' ') || (*s == '+') || (*s == '-')) s++;
|
|
||||||
if (pop) txt = _strbuf_append(txt, "/", &txt_len, &txt_alloc);
|
|
||||||
if (push) txt = _strbuf_append(txt, "+ ", &txt_len, &txt_alloc);
|
|
||||||
txt = _strbuf_append(txt, s, &txt_len, &txt_alloc);
|
|
||||||
}
|
|
||||||
txt = _strbuf_append(txt, ">", &txt_len, &txt_alloc);
|
|
||||||
}
|
|
||||||
else if ((n->type == NODE_TEXT) && (n->text))
|
|
||||||
{
|
|
||||||
const char *p = n->text;
|
|
||||||
|
|
||||||
while (*p)
|
|
||||||
{
|
|
||||||
const char *escape;
|
|
||||||
int adv;
|
|
||||||
|
|
||||||
escape = _escaped_char_match(p, &adv);
|
|
||||||
if (escape)
|
|
||||||
{
|
|
||||||
p += adv;
|
|
||||||
txt = _strbuf_append(txt, escape, &txt_len, &txt_alloc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char str[2];
|
|
||||||
|
|
||||||
str[0] = *p;
|
|
||||||
str[1] = 0;
|
|
||||||
txt = _strbuf_append(txt, str, &txt_len, &txt_alloc);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
o->markup_text = txt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a textblock to the given evas.
|
* Adds a textblock to the given evas.
|
||||||
* @param e The given evas.
|
* @param e The given evas.
|
||||||
|
@ -2609,7 +2462,7 @@ evas_textblock_style_set(Evas_Textblock_Style *ts, const char *text)
|
||||||
{
|
{
|
||||||
free(o->markup_text);
|
free(o->markup_text);
|
||||||
o->markup_text = NULL;
|
o->markup_text = NULL;
|
||||||
evas_object_textblock_text_markup_rebuild(o);
|
evas_object_textblock_text_markup_get(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2750,7 +2603,7 @@ evas_object_textblock_style_set(Evas_Object *obj, Evas_Textblock_Style *ts)
|
||||||
{
|
{
|
||||||
free(o->markup_text);
|
free(o->markup_text);
|
||||||
o->markup_text = NULL;
|
o->markup_text = NULL;
|
||||||
evas_object_textblock_text_markup_rebuild(o);
|
evas_object_textblock_text_markup_get(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (o->style)
|
if (o->style)
|
||||||
|
@ -2823,6 +2676,88 @@ evas_object_textblock_replace_char_get(Evas_Object *obj)
|
||||||
return o->repch;
|
return o->repch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
_advance_after_end_of_string(const char **p_buf)
|
||||||
|
{
|
||||||
|
while (**p_buf != 0) (*p_buf)++;
|
||||||
|
(*p_buf)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
_is_eq_and_advance(const char *s, const char *s_end,
|
||||||
|
const char **p_m, const char *m_end)
|
||||||
|
{
|
||||||
|
for (;((s < s_end) && (*p_m < m_end)); s++, (*p_m)++)
|
||||||
|
{
|
||||||
|
if (*s != **p_m)
|
||||||
|
{
|
||||||
|
_advance_after_end_of_string(p_m);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*p_m < m_end)
|
||||||
|
_advance_after_end_of_string(p_m);
|
||||||
|
|
||||||
|
return s == s_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline const char *
|
||||||
|
_escaped_char_match(const char *s, int *adv)
|
||||||
|
{
|
||||||
|
const char *map_itr, *map_end, *mc, *sc;
|
||||||
|
|
||||||
|
map_itr = escape_strings;
|
||||||
|
map_end = map_itr + sizeof(escape_strings);
|
||||||
|
|
||||||
|
while (map_itr < map_end)
|
||||||
|
{
|
||||||
|
const char *escape;
|
||||||
|
int match;
|
||||||
|
|
||||||
|
escape = map_itr;
|
||||||
|
_advance_after_end_of_string(&map_itr);
|
||||||
|
if (map_itr >= map_end) break;
|
||||||
|
|
||||||
|
mc = map_itr;
|
||||||
|
sc = s;
|
||||||
|
match = 1;
|
||||||
|
while ((*mc) && (*sc))
|
||||||
|
{
|
||||||
|
if ((unsigned char)*sc < (unsigned char)*mc) return NULL;
|
||||||
|
if (*sc != *mc) match = 0;
|
||||||
|
mc++;
|
||||||
|
sc++;
|
||||||
|
}
|
||||||
|
if (match)
|
||||||
|
{
|
||||||
|
*adv = mc - map_itr;
|
||||||
|
return escape;
|
||||||
|
}
|
||||||
|
_advance_after_end_of_string(&map_itr);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline const char *
|
||||||
|
_escaped_char_get(const char *s, const char *s_end)
|
||||||
|
{
|
||||||
|
const char *map_itr, *map_end;
|
||||||
|
|
||||||
|
map_itr = escape_strings;
|
||||||
|
map_end = map_itr + sizeof(escape_strings);
|
||||||
|
|
||||||
|
while (map_itr < map_end)
|
||||||
|
{
|
||||||
|
if (_is_eq_and_advance(s, s_end, &map_itr, map_end))
|
||||||
|
return map_itr;
|
||||||
|
if (map_itr < map_end)
|
||||||
|
_advance_after_end_of_string(&map_itr);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* to be documented.
|
* to be documented.
|
||||||
* @param escape to be documented.
|
* @param escape to be documented.
|
||||||
|
@ -3161,9 +3096,68 @@ evas_object_textblock_text_markup_prepend(Evas_Textblock_Cursor *cur, const char
|
||||||
EAPI const char *
|
EAPI const char *
|
||||||
evas_object_textblock_text_markup_get(const Evas_Object *obj)
|
evas_object_textblock_text_markup_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
Evas_Object_Textblock_Node *n;
|
||||||
|
char *txt = NULL;
|
||||||
|
int txt_len = 0, txt_alloc = 0;
|
||||||
|
|
||||||
TB_HEAD_RETURN(NULL);
|
TB_HEAD_RETURN(NULL);
|
||||||
if (o->markup_text) return(o->markup_text);
|
if (o->markup_text) return(o->markup_text);
|
||||||
evas_object_textblock_text_markup_rebuild(o);
|
EINA_INLIST_FOREACH(o->nodes, n)
|
||||||
|
{
|
||||||
|
if ((n->type == NODE_FORMAT) && (n->text))
|
||||||
|
{
|
||||||
|
char *tag = _style_match_replace(o->style, n->text);
|
||||||
|
txt = _strbuf_append(txt, "<", &txt_len, &txt_alloc);
|
||||||
|
if (tag)
|
||||||
|
{
|
||||||
|
// FIXME: need to escape
|
||||||
|
txt = _strbuf_append(txt, tag, &txt_len, &txt_alloc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
int push = 0;
|
||||||
|
int pop = 0;
|
||||||
|
|
||||||
|
// FIXME: need to escape
|
||||||
|
s = n->text;
|
||||||
|
if (*s == '+') push = 1;
|
||||||
|
if (*s == '-') pop = 1;
|
||||||
|
while ((*s == ' ') || (*s == '+') || (*s == '-')) s++;
|
||||||
|
if (pop) txt = _strbuf_append(txt, "/", &txt_len, &txt_alloc);
|
||||||
|
if (push) txt = _strbuf_append(txt, "+ ", &txt_len, &txt_alloc);
|
||||||
|
txt = _strbuf_append(txt, s, &txt_len, &txt_alloc);
|
||||||
|
}
|
||||||
|
txt = _strbuf_append(txt, ">", &txt_len, &txt_alloc);
|
||||||
|
}
|
||||||
|
else if ((n->type == NODE_TEXT) && (n->text))
|
||||||
|
{
|
||||||
|
const char *p = n->text;
|
||||||
|
|
||||||
|
while (*p)
|
||||||
|
{
|
||||||
|
const char *escape;
|
||||||
|
int adv;
|
||||||
|
|
||||||
|
escape = _escaped_char_match(p, &adv);
|
||||||
|
if (escape)
|
||||||
|
{
|
||||||
|
p += adv;
|
||||||
|
txt = _strbuf_append(txt, escape, &txt_len, &txt_alloc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char str[2];
|
||||||
|
|
||||||
|
str[0] = *p;
|
||||||
|
str[1] = 0;
|
||||||
|
txt = _strbuf_append(txt, str, &txt_len, &txt_alloc);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o->markup_text = txt;
|
||||||
return o->markup_text;
|
return o->markup_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3371,7 +3365,7 @@ evas_textblock_cursor_char_prev(Evas_Textblock_Cursor *cur)
|
||||||
{
|
{
|
||||||
int plast;
|
int plast;
|
||||||
|
|
||||||
plast = evas_common_font_utf8_get_last((unsigned char *) it->text, strlen(it->text));
|
plast = evas_common_font_utf8_get_last(it->text, strlen(it->text));
|
||||||
if ((index - it->source_pos) == plast) at_end_of_line = 1;
|
if ((index - it->source_pos) == plast) at_end_of_line = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue