From: David Lawrence Ramsey Date: Thu, 17 Mar 2005 04:24:12 +0000 (+0000) Subject: fix paragraph searching code regression: if trying to move to the line X-Git-Tag: v1.3.6~20 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=fd81a7189b7374759ad302eefbd716c90cb8175b;p=nano.git fix paragraph searching code regression: if trying to move to the line after the end of the next paragraph leaves us on the same line where we were before, the search should fail in order to avoid an infinite loop git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2383 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/src/nano.c b/src/nano.c index c67a396c..4ecbddc7 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2865,14 +2865,16 @@ 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 the line before that - * isn't in a paragraph, it means 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 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. */ if (!inpar(current)) { + filestruct *current_save = current; + do_para_end(FALSE); - if (!inpar(current->prev)) + if (current == current_save || !inpar(current->prev)) return FALSE; } if (!begpar(current))