1
1

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
Этот коммит содержится в:
David Lawrence Ramsey 2004-12-04 17:36:14 +00:00
родитель fc54d6e431
Коммит 68ebb61fb1
2 изменённых файлов: 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 {