summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2018-02-17 19:05:14 +0000
committerAndy Williams <andy@andywilliams.me>2018-02-17 19:05:14 +0000
commitdf5525b67e14be97fc9dda7af7984da351b7c9db (patch)
tree44e0dc80f39d8f83204c26d52fd941a0072a7f78
parent643a42988023c2954def5602a34fd38973773681 (diff)
downloadefl-1.20.7.tar.gz
elm_code: Fix line selection with leading tabsv1.20.7
-rw-r--r--src/lib/elementary/elm_code_widget_selection.c4
-rw-r--r--src/tests/elementary/elm_code_test_widget_selection.c7
2 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_code_widget_selection.c b/src/lib/elementary/elm_code_widget_selection.c
index fd2c161785..94d08a7767 100644
--- a/src/lib/elementary/elm_code_widget_selection.c
+++ b/src/lib/elementary/elm_code_widget_selection.c
@@ -303,6 +303,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);
@@ -311,7 +312,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
diff --git a/src/tests/elementary/elm_code_test_widget_selection.c b/src/tests/elementary/elm_code_test_widget_selection.c
index 59c1565be1..22889aaed3 100644
--- a/src/tests/elementary/elm_code_test_widget_selection.c
+++ b/src/tests/elementary/elm_code_test_widget_selection.c
@@ -536,6 +536,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);
@@ -549,6 +550,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