in do_justify(), renumber after justifying each individual paragraph,

since find_paragraph() needs the line numbers to be right as well as
edit_refresh(); this fixes a potential segfault when doing full justify
with auto-indent turned on


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3226 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-11-29 19:00:09 +00:00
parent 79383beef3
commit ad1b64cdfa
2 changed files with 16 additions and 9 deletions

View File

@ -211,6 +211,10 @@ CVS code -
as the reset_cursor() called by edit_refresh() after restoring
edittop and current will ensure that current_y is restored to
its original value. (DLR)
- Renumber after justifying each individual paragraph, since
find_paragraph() needs the line numbers to be right as well as
edit_refresh(). This fixes a potential segfault when doing
full justify with auto-indent turned on. (DLR)
do_alt_speller()
- Move the code that replaces the text of the current file with
the text of the spell-checked file into its own function,

View File

@ -1448,22 +1448,25 @@ void do_justify(bool full_justify)
} else
openfile->current_x = strlen(openfile->current->data);
/* We've just justified a paragraph. If we're not justifying the
* entire file, break out of the loop. Otherwise, continue the
* loop so that we justify all the paragraphs in the file. */
/* Renumber the lines of the now-justified paragraph, since both
* find_paragraph() and edit_refresh() need the line numbers to
* be right. */
renumber(first_par_line);
/* We've just finished justifying the paragraph. If we're not
* justifying the entire file, break out of the loop.
* Otherwise, continue the loop so that we justify all the
* paragraphs in the file. */
if (!full_justify)
break;
}
/* We are now done justifying the paragraph or the file, so clean
* up. current_y and totsize have been maintained above. If we
* actually justified something, renumber, since edit_refresh()
* needs the line numbers to be right, and set last_par_line to the
* new end of the paragraph. */
if (first_par_line != NULL) {
renumber(first_par_line);
* actually justified something, set last_par_line to the new end of
* the paragraph. */
if (first_par_line != NULL)
last_par_line = openfile->current;
}
edit_refresh();