summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-03-30 23:20:22 +0100
committerAndy Williams <andy@andywilliams.me>2017-03-30 23:20:22 +0100
commit6fb17825768c623a1ec84608b8d0830393b1ce83 (patch)
tree3e3f872d210351aca8121552a19579170eb34662
parent13cd93f729bd2be8b5ab84d4a1706c365acc7cb3 (diff)
elm_code: Fix newline crash on BSD
@fix
-rw-r--r--src/lib/elementary/elm_code_widget.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 9a5b993106..d9d7af33c6 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -613,7 +613,8 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd,
613{ 613{
614 Elm_Code *code; 614 Elm_Code *code;
615 Elm_Code_Line *line_obj; 615 Elm_Code_Line *line_obj;
616 unsigned int oldrow, position; 616 unsigned int oldrow, position, length;
617 const char *text;
617 618
618 oldrow = pd->cursor_line; 619 oldrow = pd->cursor_line;
619 pd->cursor_col = col; 620 pd->cursor_col = col;
@@ -622,7 +623,8 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd,
622 code = pd->code; 623 code = pd->code;
623 line_obj = elm_code_file_line_get(code->file, line); 624 line_obj = elm_code_file_line_get(code->file, line);
624 position = elm_code_widget_line_text_position_for_column_get(widget, line_obj, col); 625 position = elm_code_widget_line_text_position_for_column_get(widget, line_obj, col);
625 if (elm_code_line_text_get(line_obj, NULL)[position] == '\t') 626 text = elm_code_line_text_get(line_obj, &length);
627 if (position < length && text[position] == '\t')
626 pd->cursor_col = elm_code_widget_line_text_column_width_to_position(widget, line_obj, position); 628 pd->cursor_col = elm_code_widget_line_text_column_width_to_position(widget, line_obj, position);
627 629
628 if (!was_key) 630 if (!was_key)