Changeset View
Changeset View
Standalone View
Standalone View
src/lib/evas/canvas/evas_object_textblock.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 8373 Lines • ▼ Show 20 Line(s) | |||||
8374 | } | 8374 | } | ||
8375 | 8375 | | |||
8376 | 8376 | | |||
8377 | EOLIAN static void | 8377 | EOLIAN static void | ||
8378 | _efl_canvas_textblock_newline_as_paragraph_separator_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o, Eina_Bool mode) | 8378 | _efl_canvas_textblock_newline_as_paragraph_separator_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o, Eina_Bool mode) | ||
8379 | { | 8379 | { | ||
8380 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 8380 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
8381 | evas_object_async_block(obj); | 8381 | evas_object_async_block(obj); | ||
8382 | Efl_Text_Cursor_Handle *cur; | ||||
8383 | char* chr; | ||||
8384 | Eina_Bool old_mode = o->legacy_newline; | ||||
8385 | | ||||
8382 | if (o->legacy_newline == mode) | 8386 | if (o->legacy_newline == mode) | ||
8383 | return; | 8387 | return; | ||
8384 | 8388 | | |||
8385 | o->legacy_newline = mode; | 8389 | o->legacy_newline = mode; | ||
8386 | /* FIXME: Should recreate all the textnodes... For now, it's just | 8390 | | ||
8387 | * for new text inserted. */ | 8391 | if (!o->multiline) | ||
8392 | return; | ||||
8393 | | ||||
8394 | efl_event_freeze(eo_obj); | ||||
8395 | | ||||
8396 | cur = evas_object_textblock_cursor_new(eo_obj); | ||||
8397 | | ||||
8398 | do | ||||
8399 | { | ||||
8400 | chr = evas_textblock_cursor_content_get(cur); | ||||
8401 | if (chr && (!strcmp(chr, "<br>") || !strcmp(chr, "<br/>"))) | ||||
ali.alzyod: What about <br/> ? | |||||
8402 | { | ||||
8403 | o->legacy_newline = old_mode; | ||||
8404 | evas_textblock_cursor_char_delete(cur); | ||||
8405 | o->legacy_newline = mode; | ||||
8406 | evas_textblock_cursor_format_append(cur, chr); | ||||
8407 | } | ||||
8408 | } while (evas_textblock_cursor_char_next(cur)); | ||||
ali.alzyodUnsubmitted Not Done ReplyHow about iterate using Format nodes, instead of checking every character? ali.alzyod: How about iterate using Format nodes, instead of checking every character? | |||||
8409 | | ||||
8410 | evas_textblock_cursor_free(cur); | ||||
8411 | | ||||
8412 | efl_event_thaw(eo_obj); | ||||
8388 | } | 8413 | } | ||
8389 | 8414 | | |||
8390 | EOLIAN static Eina_Bool | 8415 | EOLIAN static Eina_Bool | ||
8391 | _efl_canvas_textblock_newline_as_paragraph_separator_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o) | 8416 | _efl_canvas_textblock_newline_as_paragraph_separator_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o) | ||
8392 | { | 8417 | { | ||
8393 | return o->legacy_newline; | 8418 | return o->legacy_newline; | ||
8394 | } | 8419 | } | ||
8395 | 8420 | | |||
▲ Show 20 Lines • Show All 9653 Lines • Show Last 20 Lines |
What about <br/> ?