fix still more find_paragraph() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3160 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
1be131a9f9
commit
bdff665b5d
39
src/text.c
39
src/text.c
|
@ -1042,8 +1042,6 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||||
/* Number of lines in the paragraph we search for. */
|
/* Number of lines in the paragraph we search for. */
|
||||||
filestruct *current_save;
|
filestruct *current_save;
|
||||||
/* The line at the beginning of the paragraph we search for. */
|
/* The line at the beginning of the paragraph we search for. */
|
||||||
size_t current_x_save;
|
|
||||||
/* The x-coordinate at the end of the paragraph we search for. */
|
|
||||||
ssize_t current_y_save;
|
ssize_t current_y_save;
|
||||||
/* The y-coordinate at the beginning of the paragraph we search
|
/* The y-coordinate at the beginning of the paragraph we search
|
||||||
* for. */
|
* for. */
|
||||||
|
@ -1064,17 +1062,16 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* If the current line isn't in a paragraph, move forward to the
|
/* 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
|
* line after the last line of the next paragraph, if any. If the
|
||||||
* end up on the same line, or the line before that isn't in a
|
* line before that isn't in a paragraph, it means that there aren't
|
||||||
* paragraph, it means that there aren't any paragraphs left, so get
|
* any paragraphs left, so get out. Otherwise, move back to the
|
||||||
* out. Otherwise, move back to the last line of the paragraph. If
|
* last line of the paragraph. If the current line is in a
|
||||||
* the current line is in a paragraph and it isn't the first line of
|
* paragraph and it isn't the first line of that paragraph, move
|
||||||
* that paragraph, move back to the first line. */
|
* back to the first line of the paragraph. */
|
||||||
if (!inpar(openfile->current)) {
|
if (!inpar(openfile->current)) {
|
||||||
current_save = openfile->current;
|
current_save = openfile->current;
|
||||||
do_para_end(FALSE);
|
do_para_end(FALSE);
|
||||||
if (openfile->current == current_save ||
|
if (!inpar(openfile->current->prev))
|
||||||
!inpar(openfile->current->prev))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (openfile->current != openfile->fileage)
|
if (openfile->current != openfile->fileage)
|
||||||
openfile->current = openfile->current->prev;
|
openfile->current = openfile->current->prev;
|
||||||
|
@ -1086,29 +1083,19 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||||
* 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 at the
|
* end up past the beginning of the line, it means that we're at the
|
||||||
* end of the last line of the file, and the line isn't blank. If
|
* end of the last line of the file, and the line isn't blank, in
|
||||||
* we were at the same place before, there aren't any paragraphs
|
* which case the last line of the file is part of this
|
||||||
* left, so get out. Otherwise, the last line of the file is part
|
* paragraph. */
|
||||||
* of this paragraph. */
|
|
||||||
quote_len = quote_length(openfile->current->data);
|
quote_len = quote_length(openfile->current->data);
|
||||||
current_save = openfile->current;
|
current_save = openfile->current;
|
||||||
current_x_save = openfile->current_x;
|
|
||||||
current_y_save = openfile->current_y;
|
current_y_save = openfile->current_y;
|
||||||
do_para_end(FALSE);
|
do_para_end(FALSE);
|
||||||
par_len = openfile->current->lineno - current_save->lineno;
|
par_len = openfile->current->lineno - current_save->lineno;
|
||||||
if (openfile->current_x > 0) {
|
if (openfile->current_x > 0)
|
||||||
if (openfile->current == current_save &&
|
|
||||||
openfile->current_x == current_x_save)
|
|
||||||
return FALSE;
|
|
||||||
else
|
|
||||||
par_len++;
|
par_len++;
|
||||||
}
|
|
||||||
openfile->current = current_save;
|
openfile->current = current_save;
|
||||||
openfile->current_y = current_y_save;
|
openfile->current_y = current_y_save;
|
||||||
|
|
||||||
/* Set the current place we want to where the cursor is now. */
|
|
||||||
openfile->placewewant = xplustabs();
|
|
||||||
|
|
||||||
/* Save the values of quote_len and par_len. */
|
/* Save the values of quote_len and par_len. */
|
||||||
assert(quote != NULL && par != NULL);
|
assert(quote != NULL && par != NULL);
|
||||||
|
|
||||||
|
@ -1150,8 +1137,8 @@ void do_justify(bool full_justify)
|
||||||
bool meta_key, func_key, s_or_t, ran_func, finished;
|
bool meta_key, func_key, s_or_t, ran_func, finished;
|
||||||
|
|
||||||
/* Move to the beginning of the current line, so that justifying at
|
/* Move to the beginning of the current line, so that justifying at
|
||||||
* the end of the last line of the file will work the first time if
|
* the end of the last line of the file, if that line isn't blank,
|
||||||
* that line isn't blank. */
|
* will work the first time through. */
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
|
|
||||||
/* If we're justifying the entire file, start at the beginning. */
|
/* If we're justifying the entire file, start at the beginning. */
|
||||||
|
|
Loading…
Reference in New Issue