Commit 68ebb61f authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

fix potential segfault when doing a full justify

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2156 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 11 additions and 7 deletions
+11 -7
......@@ -62,6 +62,10 @@ CVS code -
do_justify()
- For consistency, preserve placewewant if we didn't unjustify
instead of setting it to 0. (DLR)
- When justifying the entire file, properly break out of the
loop if there are no more paragraphs after the current one and
the paragraph search left us on the magicline, so as to avoid
a segfault. (DLR)
- winio.c:
unget_kbinput()
- Remove the wide character handling, as it didn't work properly
......
......@@ -2771,15 +2771,15 @@ void do_justify(bool full_justify)
/* Find the first line of the paragraph to be justified. That
* is the start of this paragraph if we're in one, or the start
* of the next otherwise. Save the quote length and paragraph
* length (number of lines). Don't refresh the screen yet
* (since we'll do that after we justify). If the search failed
* and we're justifying the whole file, move the last line of
* the text we're justifying to just before the magicline, which
* is where it'll be anyway if we've searched the entire file,
* and break out of the loop; otherwise, refresh the screen and
* length (number of lines). Don't refresh the screen yet,
* since we'll do that after we justify. If the search
* failed, we're justifying the whole file, and the search
* didn't leave us on the last line of the file, set the last
* line of the text to be justified to the last line of the file
* and break out of the loop. Otherwise, refresh the screen and
* get out. */
if (do_para_search(&quote_len, &par_len)) {
if (full_justify) {
if (full_justify && current != filebot) {
last_par_line = filebot;
break;
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment