diff -u -r1.94 fmt.c --- src/fmt.c 9 Jul 2006 17:03:20 -0000 1.94 +++ src/fmt.c 4 Jan 2007 15:35:34 -0000 @@ -607,12 +607,15 @@ const char *s; out_column = 0; - if (in_column > next_prefix_indent && c != '\n' && c != EOF) + if (in_column > next_prefix_indent || (c != '\n' && c != EOF)) { put_space (next_prefix_indent); for (s = prefix; out_column != in_column && *s; out_column++) putchar (*s++); - put_space (in_column - out_column); + if (c != EOF && c != '\n') + put_space (in_column - out_column); + if (c == EOF && in_column > next_prefix_indent) + putchar ('\n'); } while (c != '\n' && c != EOF) { @@ -688,10 +691,8 @@ flush_paragraph (); } word_limit++; - if (c == EOF) - return EOF; } - while (c != '\n'); + while (c != '\n' && c != EOF); return get_prefix (f); } diff -u -r1.14 basic --- tests/fmt/basic 17 Aug 2006 19:58:27 -0000 1.14 +++ tests/fmt/basic 4 Jan 2007 15:35:34 -0000 @@ -65,17 +65,9 @@ {IN=> " 1\n 2\n\t3\n\t\t4\n> quoted\n> text\n"}, # This is the buggy output (leading white space removed), # from coreutils-5.93. - {OUT=> "1\n2\n3\n4\n> quoted text\n"}], - # FIXME: this is the desired output - # {OUT=> " 1\n 2\n\t3\n\t\t4\n> quoted text\n"}], - - # Like the above, but when two adjacent, non-prefixed lines have - # the same indentation, ensure that they are formatted. - ['pfx-2', qw (-p '>'), - {IN=> " 1\n 2\n\t3\n\t4\n"}, - {OUT=> "1\n2\n3\n4\n"}], - # FIXME: this is the desired output - # {OUT=> " 1 2\n\t3 4\n"}], + # {OUT=> "1\n2\n3\n4\n> quoted text\n"}], + # this is the desired output + {OUT=> " 1\n 2\n\t3\n\t\t4\n> quoted text\n"}], ); my $save_temps = $ENV{DEBUG};