From 4a84ad94bacd41dfc56f2f63023f873c201d907f Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 7 Apr 2015 23:05:47 +0100 Subject: [PATCH] elm_code: Fix position calculations at line end Addresses random NULLs in content after newline --- elm_code/src/lib/elm_code_text.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/elm_code/src/lib/elm_code_text.c b/elm_code/src/lib/elm_code_text.c index 9b7d8f3..2a68413 100644 --- a/elm_code/src/lib/elm_code_text.c +++ b/elm_code/src/lib/elm_code_text.c @@ -262,13 +262,13 @@ elm_code_line_text_position_for_column_get(Elm_Code_Line *line, unsigned int col else chars = line->content; - while ((unsigned int) count < column && index <= line->length) + while ((unsigned int) count < column && index <= (int) line->length) { unicode = eina_unicode_utf8_next_get(chars, &index); - if (unicode == 0) - break; - if (unicode == '\t') + if (unicode == 0) + return line->length + 1; + else if (unicode == '\t') count += elm_code_text_tabwidth_at_position(count, tabstop); else count++;