From 79383beef3dc3dec3a343dd94eb54b4ad8211c58 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 29 Nov 2005 18:34:45 +0000 Subject: [PATCH] revert last changes, as they make full justify and justify act differently git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3225 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 7 ------- src/proto.h | 3 +-- src/text.c | 36 +++++++++--------------------------- 3 files changed, 10 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c9a05ff..c47f58fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -206,13 +206,6 @@ CVS code - text is copied and so can be used instead of the old return value. (DLR) - Remove unused quote_len parameter. (DLR) - find_paragraph() - - Add parameter begin, the line that we can't move further back - than when searching for a paragraph. This is needed to ensure - that we don't justify the same lines more than once if - auto-indent is turned on, and the indentation of what should - be the previous paragraph matches that of what should be the - current paragraph. (DLR) do_justify() - Don't save current_y and restore it if the user unjustifies, as the reset_cursor() called by edit_refresh() after restoring diff --git a/src/proto.h b/src/proto.h index 41f4bcc6..e442d144 100644 --- a/src/proto.h +++ b/src/proto.h @@ -583,8 +583,7 @@ bool indents_match(const char *a_line, size_t a_indent, const char bool begpar(const filestruct *const foo); bool inpar(const filestruct *const foo); void backup_lines(filestruct *first_line, size_t par_len); -bool find_paragraph(filestruct *begin, size_t *const quote, size_t - *const par); +bool find_paragraph(size_t *const quote, size_t *const par); void do_justify(bool full_justify); void do_justify_void(void); void do_full_justify(void); diff --git a/src/text.c b/src/text.c index 55f958cd..335aeb70 100644 --- a/src/text.c +++ b/src/text.c @@ -1066,17 +1066,15 @@ void backup_lines(filestruct *first_line, size_t par_len) set_modified(); } -/* Find the beginning of the current paragraph if we're in one (not - * going any further back than begin), or the beginning of the next - * paragraph if we're not. Afterwards, save the quote length and - * paragraph length in *quote and *par. Return TRUE if we found a - * paragraph, or FALSE if there was an error or we didn't find a - * paragraph. +/* Find the beginning of the current paragraph if we're in one, or the + * beginning of the next paragraph if we're not. Afterwards, save the + * quote length and paragraph length in *quote and *par. Return TRUE if + * we found a paragraph, or FALSE if there was an error or we didn't + * find a paragraph. * * See the comment at begpar() for more about when a line is the * beginning of a paragraph. */ -bool find_paragraph(filestruct *begin, size_t *const quote, size_t - *const par) +bool find_paragraph(size_t *const quote, size_t *const par) { size_t quote_len; /* Length of the initial quotation of the paragraph we search @@ -1127,16 +1125,9 @@ bool find_paragraph(filestruct *begin, size_t *const quote, size_t } /* If the current line isn't the first line of the paragraph, move - * back to the first line of the paragraph. If we go further back - * than begin, move forward to begin. */ - if (!begpar(openfile->current)) { + * back to the first line of the paragraph. */ + if (!begpar(openfile->current)) do_para_begin(FALSE); - if (openfile->current->lineno < begin->lineno) { - openfile->current_y += begin->lineno - - openfile->current->lineno; - openfile->current = begin; - } - } /* Now current is the first line of the paragraph. Set quote_len to * the quotation length of that line, and set par_len to the number @@ -1233,13 +1224,6 @@ void do_justify(bool full_justify) * length (number of lines). Don't refresh the screen yet, * since we'll do that after we justify. * - * When searching for a paragraph, don't go further back than - * fileage if it's the first search, or current if it isn't. - * This ensures that we don't justify the same lines more than - * once if auto-indent is turned on, and the indentation of - * what should be the previous paragraph matches that of what - * should be the current paragraph. - * * If the search failed, we do one of two things. If we're * justifying the whole file, and we've found at least one * paragraph, it means that we should justify all the way to the @@ -1247,9 +1231,7 @@ void do_justify(bool full_justify) * justified to the last line of the file and break out of the * loop. Otherwise, it means that there are no paragraph(s) to * justify, so refresh the screen and get out. */ - if (!find_paragraph((first_par_line == NULL) ? - openfile->fileage : openfile->current, "e_len, - &par_len)) { + if (!find_paragraph("e_len, &par_len)) { if (full_justify && first_par_line != NULL) { last_par_line = openfile->filebot; break; -- 2.39.5