elm_code: fix DEL at end of line.

Summary:
In one case we do not want to move the cursor.
When merging up with DEL the cursor should
remain on the same line.

Test Plan: Cursor at end of line, press delete.

Reviewers: ajwillia.ms

Reviewed By: ajwillia.ms

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6957
This commit is contained in:
Alastair Poole 2018-08-31 17:41:43 +01:00 committed by Andy Williams
parent 221ac4e51a
commit 7b3f7bf9e1
1 changed files with 5 additions and 1 deletions

View File

@ -1558,6 +1558,7 @@ _elm_code_widget_backspaceline(Elm_Code_Widget *widget, Eina_Bool nextline)
{
Elm_Code *code;
Elm_Code_Line *line, *oldline;
Eina_Bool cursor_move = EINA_TRUE;
unsigned int row, col, oldlength, position = 0;
code = elm_obj_code_widget_code_get(widget);
@ -1570,6 +1571,9 @@ _elm_code_widget_backspaceline(Elm_Code_Widget *widget, Eina_Bool nextline)
elm_code_widget_selection_end(widget, row + 1, 0);
_elm_code_widget_change_selection_add(widget);
if (col >= line->length)
cursor_move = EINA_FALSE;
elm_code_line_merge_down(line);
}
else
@ -1588,7 +1592,7 @@ _elm_code_widget_backspaceline(Elm_Code_Widget *widget, Eina_Bool nextline)
elm_code_widget_selection_clear(widget);
line = elm_code_file_line_get(code->file, row - 1);
if (line)
if (line && cursor_move)
{
if (position)
elm_code_widget_cursor_position_set(widget, row - 1, position);