summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2015-05-29 13:10:25 +0100
committerAndy Williams <andy@andywilliams.me>2015-05-29 13:10:25 +0100
commitfcce45fc82d7d7b8e6135f78a037b8cf4bd21d2c (patch)
treef56de38546582d7322071b6638e199470eaab48b
parentde37470730e0e358517efdd903546d83472d83d7 (diff)
downloadefl-fcce45fc82d7d7b8e6135f78a037b8cf4bd21d2c.tar.gz
Fix deletion inserting random data.
Off by one error (doubled). Classic. Lesson: Run the tests you write!
-rw-r--r--legacy/elm_code/src/lib/widget/elm_code_widget_selection.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/legacy/elm_code/src/lib/widget/elm_code_widget_selection.c b/legacy/elm_code/src/lib/widget/elm_code_widget_selection.c
index 5413dafd7f..6f0e65768e 100644
--- a/legacy/elm_code/src/lib/widget/elm_code_widget_selection.c
+++ b/legacy/elm_code/src/lib/widget/elm_code_widget_selection.c
@@ -142,7 +142,7 @@ _elm_code_widget_selection_delete_multi(Elm_Code_Widget_Data *pd)
first = elm_code_line_text_get(line, NULL);
line = elm_code_file_line_get(pd->code->file, pd->selection->end_line);
last = elm_code_line_text_get(line, &last_length);
- length = pd->selection->start_col + last_length - pd->selection->end_col + 1;
+ length = pd->selection->start_col + last_length - (pd->selection->end_col + 1);
content = malloc(sizeof(char) * length);
strncpy(content, first, pd->selection->start_col - 1);
strncpy(content + pd->selection->start_col - 1, last + pd->selection->end_col,