efl.ui.textbox: Enter on keyboard will add \n instead of paragraph separator

Summary: Becuase multiline_set(false) does not work with paragraphs, if user insert text by keyboard with multible line, then set multiline into false, multilines will still shown to user.

Test Plan:
```
#define EFL_EO_API_SUPPORT 1
#define EFL_BETA_API_SUPPORT 1
#include <Efl_Ui.h>
#include <Elementary.h>

static void
_multiline_click_callback(void *data, const Efl_Event *event EINA_UNUSED)
{
   Eo *tb = (Eo*) data;
   efl_text_multiline_set(tb, !efl_text_multiline_get(tb));
}

static void
_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
   efl_exit(0);
}

EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
   Eo *win, *box;

   win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
                  efl_text_set(efl_added, "Hello world"),
                  efl_ui_win_autodel_set(efl_added, EINA_TRUE));
   efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _quit_cb, NULL);
   efl_gfx_entity_size_set(win, EINA_SIZE2D(400, 240));

   box = efl_add(EFL_UI_BOX_CLASS, win,
                 efl_content_set(win, efl_added),
                 efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL));

   Eo *tb = efl_add(EFL_UI_TEXTBOX_CLASS, box,
            efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.9),
            efl_pack(box, efl_added));

   Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, box,
             efl_text_set(efl_added, "multiline switch"),
             efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.1),
             efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _multiline_click_callback, tb),
             efl_pack(box, efl_added));
}
EFL_MAIN()
```

Reviewers: woohyun, segfaultxavi

Reviewed By: woohyun

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11070
This commit is contained in:
Ali Alzyod 2020-01-13 12:46:57 +09:00 committed by WooHyun Jung
parent 3fc78f69eb
commit 3249b53d1c
1 changed files with 5 additions and 3 deletions

View File

@ -1116,14 +1116,16 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
{
if (multiline)
{
if (shift || efl_canvas_textblock_newline_as_paragraph_separator_get(obj))
//FIXME this should be Fixed when multiline set works fine with PARAGRAPH_SEPARATOR
//Now only \n can work with multiline set
//if (shift || efl_canvas_textblock_newline_as_paragraph_separator_get(obj))
{
string = "\n";
}
else
/*else
{
string = _PARAGRAPH_SEPARATOR_UTF8;
}
}*/
}
}