diff options
author | Andy Williams <andy@andywilliams.me> | 2018-02-17 19:05:14 +0000 |
---|---|---|
committer | Andy Williams <andy@andywilliams.me> | 2018-02-17 19:05:14 +0000 |
commit | df5525b67e14be97fc9dda7af7984da351b7c9db (patch) | |
tree | 44e0dc80f39d8f83204c26d52fd941a0072a7f78 | |
parent | 643a42988023c2954def5602a34fd38973773681 (diff) |
elm_code: Fix line selection with leading tabsv1.20.7
-rw-r--r-- | src/lib/elementary/elm_code_widget_selection.c | 4 | ||||
-rw-r--r-- | src/tests/elementary/elm_code_test_widget_selection.c | 7 |
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 fd2c161..94d08a7 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) | |||
303 | { | 303 | { |
304 | Elm_Code_Widget_Data *pd; | 304 | Elm_Code_Widget_Data *pd; |
305 | Elm_Code_Line *lineobj; | 305 | Elm_Code_Line *lineobj; |
306 | unsigned int col; | ||
306 | 307 | ||
307 | pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); | 308 | pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); |
308 | lineobj = elm_code_file_line_get(pd->code->file, line); | 309 | 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) | |||
311 | return; | 312 | return; |
312 | 313 | ||
313 | elm_code_widget_selection_start(widget, line, 1); | 314 | elm_code_widget_selection_start(widget, line, 1); |
314 | elm_code_widget_selection_end(widget, line, lineobj->length); | 315 | col = elm_code_widget_line_text_column_width_to_position(widget, lineobj, lineobj->length); |
316 | elm_code_widget_selection_end(widget, line, col); | ||
315 | } | 317 | } |
316 | 318 | ||
317 | #endif // ELM_CODE_TEST | 319 | #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 59c1565..22889aa 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) | |||
536 | file = elm_code_file_new(code); | 536 | file = elm_code_file_new(code); |
537 | elm_code_file_line_append(file, "line selection", 14, NULL); | 537 | elm_code_file_line_append(file, "line selection", 14, NULL); |
538 | elm_code_file_line_append(file, "line2", 5, NULL); | 538 | elm_code_file_line_append(file, "line2", 5, NULL); |
539 | elm_code_file_line_append(file, "\ttab", 4, NULL); | ||
539 | 540 | ||
540 | win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); | 541 | win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); |
541 | widget = elm_code_widget_add(win, code); | 542 | widget = elm_code_widget_add(win, code); |
@@ -549,6 +550,12 @@ START_TEST (elm_code_test_widget_selection_select_line) | |||
549 | selection = elm_code_widget_selection_text_get(widget); | 550 | selection = elm_code_widget_selection_text_get(widget); |
550 | ck_assert_str_eq("line2", selection); | 551 | ck_assert_str_eq("line2", selection); |
551 | free(selection); | 552 | free(selection); |
553 | |||
554 | elm_code_widget_selection_select_line(widget, 3); | ||
555 | selection = elm_code_widget_selection_text_get(widget); | ||
556 | ck_assert_str_eq("\ttab", selection); | ||
557 | free(selection); | ||
558 | |||
552 | elm_shutdown(); | 559 | elm_shutdown(); |
553 | } | 560 | } |
554 | END_TEST | 561 | END_TEST |