remove unneeded justify_format() call from do_justify() which caused

problems if the original paragraph was one line long and ended with a
tab or tabs; unjustification would restore the justify_format()ted line
instead of the original line


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1806 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-06-10 01:35:02 +00:00
parent 452513750b
commit 2b6c3018b0
2 changed files with 13 additions and 15 deletions

View File

@ -38,19 +38,18 @@ CVS code -
- Disable "Where Is Next" in tiny mode. (DLR) - Disable "Where Is Next" in tiny mode. (DLR)
- Added the ability to justify the entire file at once, which - Added the ability to justify the entire file at once, which
Pico has via ^W^J. Changes to do_justify(); new functions Pico has via ^W^J. Changes to do_justify(); new functions
do_justify_void() and do_full_justify(). Note that this do_justify_void() and do_full_justify(). (DLR)
feature is disabled if justification is disabled. (DLR)
- Modify the justification algorithm to work the same way as in - Modify the justification algorithm to work the same way as in
the current version of Pico, i.e, add a space at the end of the current version of Pico, i.e, add a space at the end of
each line of the justified paragraph except for the last one, each line of the justified paragraph except for the last one,
and if there was a space at the end of the last one, remove and if there was a space at the end of the last one, remove
it. Changes to justify_format() and do_justify(). (Note that it. Changes to justify_format() and do_justify(). Note that
the addition of spaces to justified lines means that we can no longer reliably detect the first modified line in a
first_mod_line can no longer be used to reliably detect the paragraph, since a line unmodified by justify_format() may get
first modified line in a paragraph, since a line unmodified by a space tacked onto the end of it or removed from the end of
justify_format() may get a space tacked onto the end of it it later. The entire original paragraph is now always backed
later, so now the entire original paragraph is always backed up, and justify_format() no longer has a non-modifying mode,
up.) (DLR) so it's now only called in backup_lines(). (DLR)
- Wrap the long jump code in NANO_SMALL #ifdefs, since we only - Wrap the long jump code in NANO_SMALL #ifdefs, since we only
use it if we're resizing the window, which is disabled when use it if we're resizing the window, which is disabled when
NANO_SMALL is defined. (DLR) NANO_SMALL is defined. (DLR)

View File

@ -2455,12 +2455,11 @@ int do_justify(int full_justify)
indent_len = quote_len + indent_length(current->data + indent_len = quote_len + indent_length(current->data +
quote_len); quote_len);
/* justify_format() removes excess spaces from the line, and /* We now call backup_lines(), which copies the original
* changes tabs to spaces. After calling it, we call * paragraph to the cutbuffer for unjustification and then
* backup_lines(), which copies the original paragraph to * calls justify_format() on each line of the original
* the cutbuffer for unjustification and then calls * paragraph. justify_format() removes excess spaces from
* justify_format() on the remaining lines. */ * the line, and changes tabs to spaces. */
justify_format(current, indent_len);
if (first_par_line == NULL) if (first_par_line == NULL)
first_par_line = backup_lines(current, full_justify ? first_par_line = backup_lines(current, full_justify ?
filebot->lineno - current->lineno : par_len, quote_len); filebot->lineno - current->lineno : par_len, quote_len);