From 60e9a1e919b38fde3bf17a851d8c17b9d51a0e90 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sat, 30 Jun 2012 14:57:45 -0300 Subject: [PATCH] tools/libtxt/edit.c (text2edit): correct handling of newlines --- tools/libtxt/edit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/libtxt/edit.c b/tools/libtxt/edit.c index 65e5f9f..4456bfd 100644 --- a/tools/libtxt/edit.c +++ b/tools/libtxt/edit.c @@ -181,8 +181,8 @@ struct edit *text2edit(const char *s) if (s != start) { add_string(&last, start, s-start); have_text = 1; - start = s+1; } + start = s+1; if (*s == '\n' && !have_text) continue; @@ -195,8 +195,10 @@ struct edit *text2edit(const char *s) *last = e; last = &e->next; - if (*s == '\n') + if (*s == '\n') { + have_text = 0; continue; + } end = strchr(s, '>'); if (!end)