fix more find_paragraph() breakage

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3159 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-11-11 03:55:52 +00:00
parent 8b203d6f22
commit 1be131a9f9
1 changed files with 14 additions and 9 deletions

View File

@ -1057,13 +1057,18 @@ bool find_paragraph(size_t *const quote, size_t *const par)
assert(openfile->current != NULL); assert(openfile->current != NULL);
/* Find the first line of the current or next paragraph. First, if /* If we're at the end of the last line of the file, it means that
* the current line isn't in a paragraph, move forward to the line * there aren't any paragraphs left, so get out. */
* after the last line of the next paragraph, if any. If we end up if (openfile->current == openfile->filebot && openfile->current_x ==
* on the same line, or the line before that isn't in a paragraph, it strlen(openfile->filebot->data))
* means that there aren't any paragraphs left, so get out. return FALSE;
* 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 /* If the current line isn't in a paragraph, move forward to the
* line after the last line of the next paragraph, if any. 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. */ * that paragraph, move back to the first line. */
if (!inpar(openfile->current)) { if (!inpar(openfile->current)) {
current_save = openfile->current; current_save = openfile->current;
@ -1080,8 +1085,8 @@ bool find_paragraph(size_t *const quote, size_t *const par)
/* Now current is the first line of the paragraph. Set quote_len to /* 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 * the quotation length of that line, and set par_len to the number
* of lines in this paragraph. If, while calculating the latter, we * of lines in this paragraph. If, while calculating the latter, we
* end up past the beginning of the line, it means that we're on the * end up past the beginning of the line, it means that we're at the
* last line of the file, and the file doesn't end in a newline. If * end of the last line of the file, and the line isn't blank. If
* we were at the same place before, there aren't any paragraphs * we were at the same place before, there aren't any paragraphs
* left, so get out. Otherwise, the last line of the file is part * left, so get out. Otherwise, the last line of the file is part
* of this paragraph. */ * of this paragraph. */