From 91bc83a97a111cfb53bbe56896640ef4010dd173 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 25 Jun 2004 01:52:10 +0000 Subject: [PATCH] call justify_format() just after backup_lines() instead of inside it, so that full justification doesn't erroneously justify non-paragraph lines in the file git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1815 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 5 +++-- src/nano.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0242ce93..8a78567a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,8 +37,9 @@ CVS code - characters and escape sequences are supported. (DLR) - 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(). (DLR) + Pico has via ^W^J. Changes to backup_lines() and + do_justify(); new functions 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, diff --git a/src/nano.c b/src/nano.c index d8217002..e469226e 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2053,7 +2053,6 @@ filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t if (alice == mark_beginbuf) mark_beginbuf = bob; #endif - justify_format(bob, quote_len + indent_length(bob->data + quote_len)); assert(alice != NULL && bob != NULL); add_to_cutbuffer(alice, FALSE); @@ -2458,15 +2457,18 @@ int do_justify(int full_justify) indent_len = quote_len + indent_length(current->data + quote_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 we haven't already done it, copy the original + * paragraph to the cutbuffer for unjustification. */ if (first_par_line == NULL) first_par_line = backup_lines(current, full_justify ? filebot->lineno - current->lineno : par_len, quote_len); + /* Now we call justify_format() on the current line of the + * paragraph, which will remove excess spaces from it and + * change tabs to spaces. */ + justify_format(current, quote_len + + indent_length(current->data + quote_len)); + line_len = strlen(current->data); display_len = strlenpt(current->data); -- 2.39.5