parent
1e13a4aec2
commit
9517f8f0e0
|
@ -7,6 +7,6 @@ Name: evas
|
||||||
Description: Evas canvas display library
|
Description: Evas canvas display library
|
||||||
Requires: eina-0
|
Requires: eina-0
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Libs: -L${libdir} -levas
|
Libs: -L${libdir} -levas @EINA_LIBS@
|
||||||
Libs.private: @pthread_libs@ @dlopen_libs@ @EDB_LIBS@ @EET_LIBS@ @FREETYPE_LIBS@ @FONTCONFIG_LIBS@
|
Libs.private: @pthread_libs@ @dlopen_libs@ @EDB_LIBS@ @EET_LIBS@ @FREETYPE_LIBS@ @FONTCONFIG_LIBS@
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir} @EINA_CFLAGS@
|
||||||
|
|
|
@ -532,6 +532,7 @@ static const char escape_strings[] =
|
||||||
"<\0\x3c\0"
|
"<\0\x3c\0"
|
||||||
">\0\x3e\0"
|
">\0\x3e\0"
|
||||||
"&\0\x26\0"
|
"&\0\x26\0"
|
||||||
|
" \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\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\x22\0"
|
||||||
/* all the rest */
|
/* all the rest */
|
||||||
|
@ -2064,6 +2065,7 @@ _layout(const Evas_Object *obj, int calc_only, int w, int h, int *w_ret, int *h_
|
||||||
c->align = 0.0;
|
c->align = 0.0;
|
||||||
|
|
||||||
_format_command_init();
|
_format_command_init();
|
||||||
|
printf("LAYOUT!\n");
|
||||||
/* setup default base style */
|
/* setup default base style */
|
||||||
if ((c->o->style) && (c->o->style->default_tag))
|
if ((c->o->style) && (c->o->style->default_tag))
|
||||||
{
|
{
|
||||||
|
@ -2597,6 +2599,40 @@ _is_eq_and_advance(const char *s, const char *s_end,
|
||||||
return s == s_end;
|
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);
|
||||||
|
mc = map_itr;
|
||||||
|
sc = s;
|
||||||
|
match = 1;
|
||||||
|
while ((*mc) && (*sc))
|
||||||
|
{
|
||||||
|
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 void
|
static inline void
|
||||||
_append_escaped_char(Evas_Textblock_Cursor *cur, const char *s,
|
_append_escaped_char(Evas_Textblock_Cursor *cur, const char *s,
|
||||||
const char *s_end)
|
const char *s_end)
|
||||||
|
@ -2956,31 +2992,29 @@ evas_object_textblock_text_markup_get(const Evas_Object *obj)
|
||||||
}
|
}
|
||||||
else if ((n->type == NODE_TEXT) && (n->text))
|
else if ((n->type == NODE_TEXT) && (n->text))
|
||||||
{
|
{
|
||||||
if (strchr(n->text, '<') || strchr(n->text, '>') ||
|
const char *p = n->text;
|
||||||
strchr(n->text, '&'))
|
|
||||||
{
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
p = n->text;
|
|
||||||
while (*p)
|
while (*p)
|
||||||
{
|
{
|
||||||
char s[2];
|
const char *escape;
|
||||||
|
int adv;
|
||||||
|
|
||||||
s[0] = *p;
|
escape = _escaped_char_match(p, &adv);
|
||||||
s[1] = 0;
|
if (escape)
|
||||||
if (s[0] == '<')
|
{
|
||||||
txt = _strbuf_append(txt, "<", &txt_len, &txt_alloc);
|
p += adv;
|
||||||
else if (s[0] == '>')
|
txt = _strbuf_append(txt, escape, &txt_len, &txt_alloc);
|
||||||
txt = _strbuf_append(txt, ">", &txt_len, &txt_alloc);
|
}
|
||||||
else if (s[0] == '&')
|
|
||||||
txt = _strbuf_append(txt, "&", &txt_len, &txt_alloc);
|
|
||||||
else
|
else
|
||||||
txt = _strbuf_append(txt, s, &txt_len, &txt_alloc);
|
{
|
||||||
|
char str[2];
|
||||||
|
|
||||||
|
str[0] = *p;
|
||||||
|
str[1] = 0;
|
||||||
|
txt = _strbuf_append(txt, str, &txt_len, &txt_alloc);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
txt = _strbuf_append(txt, n->text, &txt_len, &txt_alloc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
o->markup_text = txt;
|
o->markup_text = txt;
|
||||||
|
@ -4257,8 +4291,8 @@ evas_textblock_cursor_range_text_get(const Evas_Textblock_Cursor *cur1, const Ev
|
||||||
{
|
{
|
||||||
Evas_Object_Textblock *o;
|
Evas_Object_Textblock *o;
|
||||||
Evas_Object_Textblock_Node *n1, *n2, *n;
|
Evas_Object_Textblock_Node *n1, *n2, *n;
|
||||||
char *str = NULL, *s;
|
char *txt = NULL, *s;
|
||||||
int len = 0, alloc = 0, chr, index;
|
int txt_len = 0, txt_alloc = 0, chr, index;
|
||||||
|
|
||||||
if (!cur1) return NULL;
|
if (!cur1) return NULL;
|
||||||
if (!cur2) return NULL;
|
if (!cur2) return NULL;
|
||||||
|
@ -4282,9 +4316,6 @@ evas_textblock_cursor_range_text_get(const Evas_Textblock_Cursor *cur1, const Ev
|
||||||
{
|
{
|
||||||
s = n->text;
|
s = n->text;
|
||||||
if (format == EVAS_TEXTBLOCK_TEXT_MARKUP)
|
if (format == EVAS_TEXTBLOCK_TEXT_MARKUP)
|
||||||
{
|
|
||||||
if (strchr(n->text, '<') || strchr(n->text, '>') ||
|
|
||||||
strchr(n->text, '&'))
|
|
||||||
{
|
{
|
||||||
char *p, *ps, *pe;
|
char *p, *ps, *pe;
|
||||||
|
|
||||||
|
@ -4308,41 +4339,25 @@ evas_textblock_cursor_range_text_get(const Evas_Textblock_Cursor *cur1, const Ev
|
||||||
ps = n->text;
|
ps = n->text;
|
||||||
pe = ps + strlen(ps);
|
pe = ps + strlen(ps);
|
||||||
}
|
}
|
||||||
for (p = ps; p < pe; p++)
|
while (p < pe)
|
||||||
{
|
{
|
||||||
char st[2];
|
const char *escape;
|
||||||
|
int adv;
|
||||||
|
|
||||||
st[0] = *p;
|
escape = _escaped_char_match(p, &adv);
|
||||||
st[1] = 0;
|
if (escape)
|
||||||
if (st[0] == '<')
|
{
|
||||||
str = _strbuf_append(str, "<", &len, &alloc);
|
p += adv;
|
||||||
else if (st[0] == '>')
|
txt = _strbuf_append(txt, escape, &txt_len, &txt_alloc);
|
||||||
str = _strbuf_append(str, ">", &len, &alloc);
|
|
||||||
else if (st[0] == '&')
|
|
||||||
str = _strbuf_append(str, "&", &len, &alloc);
|
|
||||||
else
|
|
||||||
str = _strbuf_append(str, st, &len, &alloc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((n == n1) && (n == n2))
|
char str[2];
|
||||||
{
|
|
||||||
s += cur1->pos;
|
str[0] = *p;
|
||||||
str = _strbuf_append_n(str, s, index - cur1->pos, &len, &alloc);
|
str[1] = 0;
|
||||||
}
|
txt = _strbuf_append(txt, str, &txt_len, &txt_alloc);
|
||||||
else if (n == n1)
|
p++;
|
||||||
{
|
|
||||||
s += cur1->pos;
|
|
||||||
str = _strbuf_append(str, s, &len, &alloc);
|
|
||||||
}
|
|
||||||
else if (n == n2)
|
|
||||||
{
|
|
||||||
str = _strbuf_append_n(str, s, index, &len, &alloc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
str = _strbuf_append(str, s, &len, &alloc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4351,21 +4366,21 @@ evas_textblock_cursor_range_text_get(const Evas_Textblock_Cursor *cur1, const Ev
|
||||||
if ((n == n1) && (n == n2))
|
if ((n == n1) && (n == n2))
|
||||||
{
|
{
|
||||||
s += cur1->pos;
|
s += cur1->pos;
|
||||||
str = _strbuf_append_n(str, s, index - cur1->pos, &len, &alloc);
|
txt = _strbuf_append_n(txt, s, index - cur1->pos, &txt_len, &txt_alloc);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (n == n1)
|
else if (n == n1)
|
||||||
{
|
{
|
||||||
s += cur1->pos;
|
s += cur1->pos;
|
||||||
str = _strbuf_append(str, s, &len, &alloc);
|
txt = _strbuf_append(txt, s, &txt_len, &txt_alloc);
|
||||||
}
|
}
|
||||||
else if (n == n2)
|
else if (n == n2)
|
||||||
{
|
{
|
||||||
str = _strbuf_append_n(str, s, index, &len, &alloc);
|
txt = _strbuf_append_n(txt, s, index, &txt_len, &txt_alloc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str = _strbuf_append(str, s, &len, &alloc);
|
txt = _strbuf_append(txt, s, &txt_len, &txt_alloc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4377,20 +4392,20 @@ evas_textblock_cursor_range_text_get(const Evas_Textblock_Cursor *cur1, const Ev
|
||||||
while (*s)
|
while (*s)
|
||||||
{
|
{
|
||||||
if (*s == '\n')
|
if (*s == '\n')
|
||||||
str = _strbuf_append(str, "\n", &len, &alloc);
|
txt = _strbuf_append(txt, "\n", &txt_len, &txt_alloc);
|
||||||
else if (*s == '\t')
|
else if (*s == '\t')
|
||||||
str = _strbuf_append(str, "\t", &len, &alloc);
|
txt = _strbuf_append(txt, "\t", &txt_len, &txt_alloc);
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (format == EVAS_TEXTBLOCK_TEXT_MARKUP)
|
else if (format == EVAS_TEXTBLOCK_TEXT_MARKUP)
|
||||||
{
|
{
|
||||||
char *tag = _style_match_replace(o->style, n->text);
|
char *tag = _style_match_replace(o->style, n->text);
|
||||||
str = _strbuf_append(str, "<", &len, &alloc);
|
txt = _strbuf_append(txt, "<", &txt_len, &txt_alloc);
|
||||||
if (tag)
|
if (tag)
|
||||||
{
|
{
|
||||||
// FIXME: need to escape
|
// FIXME: need to escape
|
||||||
str = _strbuf_append(str, tag, &len, &alloc);
|
txt = _strbuf_append(txt, tag, &txt_len, &txt_alloc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4402,16 +4417,16 @@ evas_textblock_cursor_range_text_get(const Evas_Textblock_Cursor *cur1, const Ev
|
||||||
if (*s == '+') push = 1;
|
if (*s == '+') push = 1;
|
||||||
if (*s == '-') pop = 1;
|
if (*s == '-') pop = 1;
|
||||||
while ((*s == ' ') || (*s == '+') || (*s == '-')) s++;
|
while ((*s == ' ') || (*s == '+') || (*s == '-')) s++;
|
||||||
if (pop) str = _strbuf_append(str, "/", &len, &alloc);
|
if (pop) txt = _strbuf_append(txt, "/", &txt_len, &txt_alloc);
|
||||||
if (push) str = _strbuf_append(str, "+ ", &len, &alloc);
|
if (push) txt = _strbuf_append(txt, "+ ", &txt_len, &txt_alloc);
|
||||||
str = _strbuf_append(str, s, &len, &alloc);
|
txt = _strbuf_append(txt, s, &txt_len, &txt_alloc);
|
||||||
}
|
}
|
||||||
str = _strbuf_append(str, ">", &len, &alloc);
|
txt = _strbuf_append(txt, ">", &txt_len, &txt_alloc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (n == n2) break;
|
if (n == n2) break;
|
||||||
}
|
}
|
||||||
return str;
|
return txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue