sync with 69949 : fix a bug about filter callback
authorWooHyun Jung <wh0705.jung@samsung.com>
Fri, 6 Apr 2012 08:24:16 +0000 (17:24 +0900)
committerWooHyun Jung <wh0705.jung@samsung.com>
Fri, 6 Apr 2012 08:24:16 +0000 (17:24 +0900)
src/lib/elm_entry.c

index 57f7945..4331d42 100644 (file)
@@ -3825,7 +3825,8 @@ elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text)
    if (lim->max_char_count > 0)
      {
         len = evas_string_char_len_get(current);
-        if (len >= lim->max_char_count)
+        newlen = evas_string_char_len_get(utfstr);
+        if ((len >= lim->max_char_count) && (newlen > 0))
           {
              evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
              free(*text);
@@ -3834,14 +3835,14 @@ elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text)
              free(utfstr);
              return;
           }
-        newlen = evas_string_char_len_get(utfstr);
         if ((len + newlen) > lim->max_char_count)
           _add_chars_till_limit(entry, text, (lim->max_char_count - len), LENGTH_UNIT_CHAR);
      }
    else if (lim->max_byte_count > 0)
      {
         len = strlen(current);
-        if (len >= lim->max_byte_count)
+        newlen = strlen(utfstr);
+        if ((len >= lim->max_byte_count) && (newlen > 0))
           {
              evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
              free(*text);
@@ -3850,7 +3851,6 @@ elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text)
              free(utfstr);
              return;
           }
-        newlen = strlen(utfstr);
         if ((len + newlen) > lim->max_byte_count)
           _add_chars_till_limit(entry, text, (lim->max_byte_count - len), LENGTH_UNIT_BYTE);
      }