From 1fb660f6cc2d2e89026c9d5ab74ab00548da2826 Mon Sep 17 00:00:00 2001 From: Dom Lachowicz Date: Sun, 31 Aug 2003 15:22:10 +0000 Subject: fix ispell -a compatibility mode git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@20837 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6 --- tests/enchant-ispell.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/enchant-ispell.c b/tests/enchant-ispell.c index 141d7cb..e12aa0e 100644 --- a/tests/enchant-ispell.c +++ b/tests/enchant-ispell.c @@ -216,7 +216,7 @@ parse_file (FILE * in, FILE * out, IspellMode_t mode) const gchar * lang; size_t pos; - gboolean was_last_line = FALSE; + gboolean was_last_line = FALSE, corrected_something = FALSE; if (mode == MODE_A) print_version (out); @@ -240,8 +240,10 @@ parse_file (FILE * in, FILE * out, IspellMode_t mode) if (str->len) { + corrected_something = FALSE; token_ptr = tokens = tokenize_line (str); while (tokens != NULL) { + corrected_something = TRUE; word = (GString *)tokens->data; tokens = tokens->next; @@ -260,15 +262,11 @@ parse_file (FILE * in, FILE * out, IspellMode_t mode) if (token_ptr) g_slist_free (token_ptr); - else if (mode == MODE_A) - fwrite ("\n", 1, 1, out); } - else if (mode == MODE_A && !was_last_line) - fwrite ("\n", 1, 1, out); - if (mode == MODE_A) + if (mode == MODE_A && corrected_something) fwrite ("\n", 1, 1, out); - + g_string_truncate (str, 0); } -- cgit v1.2.1