Evas textblock: Fixed the bug with going up/down lines when the cursor points to...
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 15 Aug 2010 16:04:34 +0000 (16:04 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 15 Aug 2010 16:04:34 +0000 (16:04 +0000)
With this fix I also fixed a couple of potential bugs with cursor geometry in places with mixed visible+invisible formatting.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@51133 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_textblock.c
src/lib/engines/common/evas_bidi_utils.h

index a7652b7..91517bf 100644 (file)
@@ -4681,7 +4681,7 @@ evas_textblock_cursor_line_char_first(Evas_Textblock_Cursor *cur)
      {
         _find_layout_format_item_line_match(cur->obj,
               _evas_textblock_node_visible_at_pos_get(
-                 _evas_textblock_cursor_node_format_before_or_at_pos_get(cur)),
+                 _evas_textblock_cursor_node_format_at_pos_get(cur)),
               &ln, &fi);
      }
    else
@@ -4734,7 +4734,7 @@ evas_textblock_cursor_line_char_last(Evas_Textblock_Cursor *cur)
      {
         _find_layout_format_item_line_match(cur->obj,
               _evas_textblock_node_visible_at_pos_get(
-                 _evas_textblock_cursor_node_format_before_or_at_pos_get(cur)),
+                 _evas_textblock_cursor_node_format_at_pos_get(cur)),
               &ln, &fi);
      }
    else
@@ -4786,9 +4786,11 @@ _evas_textblock_format_is_visible(const char *s)
 {
    if (!s) return EINA_FALSE;
    const char *item;
+   Eina_Bool is_opener = EINA_TRUE;
 
    if (s[0] == '+' || s[0] == '-')
      {
+        is_opener = (s[0] == '+') ? EINA_TRUE : EINA_FALSE;
         s++;
      }
    while ((item = _format_parse(&s)))
@@ -4797,10 +4799,13 @@ _evas_textblock_format_is_visible(const char *s)
         tmp = alloca(s - item + 1);
         strncpy(tmp, item, s - item);
         tmp[s - item] = '\0';
+        /* We care about all of the formats even after a - except for
+         * item which we don't care after a - because it's just a standard
+         * closing */
         if (((!strcmp(item, "\n")) || (!strcmp(item, "\\n"))) ||
               ((!strcmp(item, "\t")) || (!strcmp(item, "\\t"))) ||
               (!strcmp(item, "ps")) ||
-              (!strcmp(item, "item")))
+              (!strncmp(item, "item", 4) && is_opener)) /*FIXME: formats like item2 will break it. */
           return EINA_TRUE;
      }
    return EINA_FALSE;
@@ -6109,8 +6114,9 @@ evas_textblock_cursor_char_geometry_get(const Evas_Textblock_Cursor *cur, Evas_C
    if (!o->formatted.valid) _relayout(cur->obj);
    if (evas_textblock_cursor_format_is_visible_get(cur))
      {
-       _find_layout_format_item_line_match(cur->obj,
-              _evas_textblock_cursor_node_format_at_pos_get(cur),
+        _find_layout_format_item_line_match(cur->obj,
+              _evas_textblock_node_visible_at_pos_get(
+                 _evas_textblock_cursor_node_format_at_pos_get(cur)),
               &ln, &fi);
      }
    else
@@ -6202,7 +6208,7 @@ evas_textblock_cursor_line_geometry_get(const Evas_Textblock_Cursor *cur, Evas_C
           {
              _find_layout_format_item_line_match(cur->obj,
                    _evas_textblock_node_visible_at_pos_get(
-                      _evas_textblock_cursor_node_format_before_or_at_pos_get(cur)),
+                      _evas_textblock_cursor_node_format_at_pos_get(cur)),
                    &ln, &fi);
           }
         else
@@ -6446,11 +6452,13 @@ evas_textblock_cursor_format_item_geometry_get(const Evas_Textblock_Cursor *cur,
    Evas_Object_Textblock_Format_Item *fi = NULL;
    Evas_Coord x, y, w, h;
 
-   if (!cur) return 0;
+   if (!cur || !evas_textblock_cursor_format_is_visible_get(cur)) return 0;
    o = (Evas_Object_Textblock *)(cur->obj->object_data);
    if (!o->formatted.valid) _relayout(cur->obj);
    _find_layout_format_item_line_match(cur->obj,
-         _evas_textblock_cursor_node_format_before_or_at_pos_get(cur), &ln, &fi);
+         _evas_textblock_node_visible_at_pos_get(
+            _evas_textblock_cursor_node_format_at_pos_get(cur)),
+         &ln, &fi);
    if ((!ln) || (!fi)) return 0;
    x = ln->x + fi->x;
    y = ln->y + ln->baseline + fi->y;
index 6902cd7..0d51675 100644 (file)
@@ -80,6 +80,8 @@ struct _Evas_BiDi_Props {
 
 
 #ifdef USE_FRIBIDI
+
+
 #define EVAS_BIDI_PARAGRAPH_NATURAL FRIBIDI_PAR_ON
 #define EVAS_BIDI_PARAGRAPH_LTR     FRIBIDI_PAR_LTR
 #define EVAS_BIDI_PARAGRAPH_RTL     FRIBIDI_PAR_RTL