mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-08 10:42:00 +03:00
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
This commit is contained in:
parent
79383beef3
commit
ad1b64cdfa
@ -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,
|
||||
|
21
src/text.c
21
src/text.c
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user