commit 6b94e95ec9fab2295845df1a1c44894274d50b25
parent aad85151ae7ad79cca644550cd73006006108ae9
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 22 Mar 2005 01:53:57 +0000
in find_paragraph(), fix a problem where a search for the next paragraph
would skip over certain cases of one-line paragraphs
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2413 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -21,6 +21,9 @@ CVS code -
- Fix erroneous #ifdef that resulted in the -d/--rebinddelete
and -k/--cut options' not being printed when NANO_SMALL was
defined. (DLR)
+ find_paragraph()
+ - Fix problem where a search for the next paragraph would skip
+ over certain cases of one-line paragraphs. (DLR)
do_justify()
- Instead of breaking a line at a space and readding the space
afterwards, just break the line after the space, as it's more
diff --git a/src/nano.c b/src/nano.c
@@ -2887,17 +2887,20 @@ bool find_paragraph(size_t *const quote, size_t *const par)
/* Find the first line of the current or next paragraph. First, if
* the current line isn't in a paragraph, move forward to the line
- * after the end of the next paragraph. If we end up on the same
- * line, or the line before that isn't in a paragraph, it means that
- * there aren't any paragraphs left, so get out. Otherwise, if the
- * current line is in a paragraph and it isn't the first line of
- * that paragraph, move back to the first line. */
+ * after the last line of the next paragraph. If we end up on the
+ * same line, or the line before that isn't in a paragraph, it means
+ * that there aren't any paragraphs left, so get out. Otherwise,
+ * move back to the last line of the paragraph. If the current line
+ * is in a paragraph and it isn't the first line of that paragraph,
+ * move back to the first line. */
if (!inpar(current)) {
filestruct *current_save = current;
do_para_end(FALSE);
if (current == current_save || !inpar(current->prev))
return FALSE;
+ if (current->prev != NULL)
+ current = current->prev;
}
if (!begpar(current))
do_para_begin(FALSE);