forked from enlightenment/efl
elm_code: Fix line selection with leading tabs
This commit is contained in:
parent
28201f32a6
commit
3b60da0e37
|
@ -302,6 +302,7 @@ elm_code_widget_selection_select_line(Evas_Object *widget, unsigned int line)
|
|||
{
|
||||
Elm_Code_Widget_Data *pd;
|
||||
Elm_Code_Line *lineobj;
|
||||
unsigned int col;
|
||||
|
||||
pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
|
||||
lineobj = elm_code_file_line_get(pd->code->file, line);
|
||||
|
@ -310,7 +311,8 @@ elm_code_widget_selection_select_line(Evas_Object *widget, unsigned int line)
|
|||
return;
|
||||
|
||||
elm_code_widget_selection_start(widget, line, 1);
|
||||
elm_code_widget_selection_end(widget, line, lineobj->length);
|
||||
col = elm_code_widget_line_text_column_width_to_position(widget, lineobj, lineobj->length);
|
||||
elm_code_widget_selection_end(widget, line, col);
|
||||
}
|
||||
|
||||
#endif // ELM_CODE_TEST
|
||||
|
|
|
@ -551,6 +551,7 @@ START_TEST (elm_code_test_widget_selection_select_line)
|
|||
file = elm_code_file_new(code);
|
||||
elm_code_file_line_append(file, "line selection", 14, NULL);
|
||||
elm_code_file_line_append(file, "line2", 5, NULL);
|
||||
elm_code_file_line_append(file, "\ttab", 4, NULL);
|
||||
|
||||
win = elm_win_add(NULL, "entry", ELM_WIN_BASIC);
|
||||
widget = elm_code_widget_add(win, code);
|
||||
|
@ -564,6 +565,12 @@ START_TEST (elm_code_test_widget_selection_select_line)
|
|||
selection = elm_code_widget_selection_text_get(widget);
|
||||
ck_assert_str_eq("line2", selection);
|
||||
free(selection);
|
||||
|
||||
elm_code_widget_selection_select_line(widget, 3);
|
||||
selection = elm_code_widget_selection_text_get(widget);
|
||||
ck_assert_str_eq("\ttab", selection);
|
||||
free(selection);
|
||||
|
||||
elm_shutdown();
|
||||
}
|
||||
END_TEST
|
||||
|
|
Loading…
Reference in New Issue