commit 2b6c3018b083c826635efca9867dcaa302389d18
parent 452513750b6c0926675c54eeddee890174434927
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 10 Jun 2004 01:35:02 +0000
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
Diffstat:
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -38,19 +38,18 @@ CVS code -
- Disable "Where Is Next" in tiny mode. (DLR)
- Added the ability to justify the entire file at once, which
Pico has via ^W^J. Changes to do_justify(); new functions
- do_justify_void() and do_full_justify(). Note that this
- feature is disabled if justification is disabled. (DLR)
+ do_justify_void() and do_full_justify(). (DLR)
- 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
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
- it. Changes to justify_format() and do_justify(). (Note that
- the addition of spaces to justified lines means that
- first_mod_line can no longer be used to reliably detect the
- first modified line in a paragraph, since a line unmodified by
- justify_format() may get a space tacked onto the end of it
- later, so now the entire original paragraph is always backed
- up.) (DLR)
+ it. Changes to justify_format() and do_justify(). Note that
+ we can no longer reliably detect the first modified line in a
+ paragraph, since a line unmodified by justify_format() may get
+ a space tacked onto the end of it or removed from the end of
+ it later. The entire original paragraph is now always backed
+ up, and justify_format() no longer has a non-modifying mode,
+ so it's now only called in backup_lines(). (DLR)
- Wrap the long jump code in NANO_SMALL #ifdefs, since we only
use it if we're resizing the window, which is disabled when
NANO_SMALL is defined. (DLR)
diff --git a/src/nano.c b/src/nano.c
@@ -2455,12 +2455,11 @@ int do_justify(int full_justify)
indent_len = quote_len + indent_length(current->data +
quote_len);
- /* justify_format() removes excess spaces from the line, and
- * changes tabs to spaces. After calling it, we call
- * backup_lines(), which copies the original paragraph to
- * the cutbuffer for unjustification and then calls
- * justify_format() on the remaining lines. */
- justify_format(current, indent_len);
+ /* We now call backup_lines(), which copies the original
+ * paragraph to the cutbuffer for unjustification and then
+ * calls justify_format() on each line of the original
+ * paragraph. justify_format() removes excess spaces from
+ * the line, and changes tabs to spaces. */
if (first_par_line == NULL)
first_par_line = backup_lines(current, full_justify ?
filebot->lineno - current->lineno : par_len, quote_len);