more do_justify() breakage fixes, and miscellaneous comment fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3137 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-11-09 23:06:44 +00:00
parent c82bc8ba84
commit af5a9997fd
1 changed files with 8 additions and 6 deletions

View File

@ -947,7 +947,7 @@ bool inpar(const filestruct *const foo)
quote_len)] != '\0'); quote_len)] != '\0');
} }
/* Put the next par_len lines, starting with first_line, into the /* Move the next par_len lines, starting with first_line, into the
* justify buffer, leaving copies of those lines in place. Assume that * justify buffer, leaving copies of those lines in place. Assume that
* par_len is greater than zero, and that there are enough lines after * par_len is greater than zero, and that there are enough lines after
* first_line. Return the new copy of first_line. */ * first_line. Return the new copy of first_line. */
@ -1203,9 +1203,10 @@ void do_justify(bool full_justify)
* to the justify buffer. */ * to the justify buffer. */
if (first_par_line == NULL) if (first_par_line == NULL)
first_par_line = backup_lines(openfile->current, first_par_line = backup_lines(openfile->current,
full_justify ? ((openfile->current == full_justify ? (openfile->filebot->lineno -
openfile->filebot) ? 1 : openfile->filebot->lineno - openfile->current->lineno +
openfile->current->lineno) : par_len); (openfile->filebot->data[0] != '\0') ? 1 : 0) :
par_len);
/* Initialize indent_string to a blank string. */ /* Initialize indent_string to a blank string. */
indent_string = mallocstrcpy(NULL, ""); indent_string = mallocstrcpy(NULL, "");
@ -1448,10 +1449,11 @@ void do_justify(bool full_justify)
/* Partition the filestruct so that it contains only the /* Partition the filestruct so that it contains only the
* text of the justified paragraph. */ * text of the justified paragraph. */
filepart = partition_filestruct(first_par_line, 0, filepart = partition_filestruct(first_par_line, 0,
last_par_line, strlen(last_par_line->data)); last_par_line, (last_par_line == openfile->filebot) ?
strlen(last_par_line->data) : 0);
/* Remove the text of the justified paragraph, and /* Remove the text of the justified paragraph, and
* put the text in the justify buffer in its place. */ * replace it with the text in the justify buffer. */
free_filestruct(openfile->fileage); free_filestruct(openfile->fileage);
openfile->fileage = jusbuffer; openfile->fileage = jusbuffer;
openfile->filebot = jusbottom; openfile->filebot = jusbottom;