diff options
Diffstat (limited to '')
-rw-r--r-- | src/text_file.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/text_file.c b/src/text_file.c index 80559b785..355217aba 100644 --- a/src/text_file.c +++ b/src/text_file.c @@ -57,7 +57,12 @@ read_text_line(FILE *file, GString *buffer) g_string_set_size(buffer, length + step); } + /* remove the newline characters */ + if (buffer->str[length - 1] == '\n') + --length; + if (buffer->str[length - 1] == '\r') + --length; + g_string_set_size(buffer, length); - g_strchomp(buffer->str); return buffer->str; } |