fix breakage in both backup_lines() and do_justify(); the latter's
return value is unneeded, as current will point to the same line when it's done, and making first_par_line point to current in the former ensures that the two will properly stay in sync git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3155 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
52161ee3a1
commit
cd8f73521e
|
@ -110,6 +110,10 @@ CVS code -
|
||||||
begpar()
|
begpar()
|
||||||
- Return FALSE if foo is NULL, as inpar() does. (DLR)
|
- Return FALSE if foo is NULL, as inpar() does. (DLR)
|
||||||
backup_lines()
|
backup_lines()
|
||||||
|
- Return void instead of a pointer to the copy of the first
|
||||||
|
line, since current will point to the same location after the
|
||||||
|
text is copied and so can be used instead of the old return
|
||||||
|
value. (DLR)
|
||||||
- Remove unused quote_len parameter. (DLR)
|
- Remove unused quote_len parameter. (DLR)
|
||||||
do_alt_speller()
|
do_alt_speller()
|
||||||
- Move the code that replaces the text of the current file with
|
- Move the code that replaces the text of the current file with
|
||||||
|
|
|
@ -563,7 +563,7 @@ bool indents_match(const char *a_line, size_t a_indent, const char
|
||||||
*b_line, size_t b_indent);
|
*b_line, size_t b_indent);
|
||||||
bool begpar(const filestruct *const foo);
|
bool begpar(const filestruct *const foo);
|
||||||
bool inpar(const filestruct *const foo);
|
bool inpar(const filestruct *const foo);
|
||||||
filestruct *backup_lines(filestruct *first_line, size_t par_len);
|
void backup_lines(filestruct *first_line, size_t par_len);
|
||||||
bool find_paragraph(size_t *const quote, size_t *const par);
|
bool find_paragraph(size_t *const quote, size_t *const par);
|
||||||
void do_justify(bool full_justify);
|
void do_justify(bool full_justify);
|
||||||
void do_justify_void(void);
|
void do_justify_void(void);
|
||||||
|
|
21
src/text.c
21
src/text.c
|
@ -950,8 +950,8 @@ bool inpar(const filestruct *const foo)
|
||||||
/* Move 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. */
|
||||||
filestruct *backup_lines(filestruct *first_line, size_t par_len)
|
void backup_lines(filestruct *first_line, size_t par_len)
|
||||||
{
|
{
|
||||||
filestruct *top = first_line;
|
filestruct *top = first_line;
|
||||||
/* The top of the paragraph we're backing up. */
|
/* The top of the paragraph we're backing up. */
|
||||||
|
@ -1023,8 +1023,6 @@ filestruct *backup_lines(filestruct *first_line, size_t par_len)
|
||||||
openfile->current_x = current_x_save;
|
openfile->current_x = current_x_save;
|
||||||
|
|
||||||
set_modified();
|
set_modified();
|
||||||
|
|
||||||
return first_line;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the beginning of the current paragraph if we're in one, or the
|
/* Find the beginning of the current paragraph if we're in one, or the
|
||||||
|
@ -1209,14 +1207,17 @@ void do_justify(bool full_justify)
|
||||||
filebot_inpar = (openfile->current->lineno + par_len ==
|
filebot_inpar = (openfile->current->lineno + par_len ==
|
||||||
openfile->filebot->lineno + 1);
|
openfile->filebot->lineno + 1);
|
||||||
|
|
||||||
/* If we haven't already done it, copy the original paragraph(s)
|
/* If we haven't already done it, move the original paragraph(s)
|
||||||
* to the justify buffer. */
|
* to the justify buffer, splice a copy of the original
|
||||||
if (first_par_line == NULL)
|
* paragraph(s) into the file in the same place, and set
|
||||||
first_par_line = backup_lines(openfile->current,
|
* first_par_line to the first line of the copy. */
|
||||||
full_justify ? (openfile->filebot->lineno -
|
if (first_par_line == NULL) {
|
||||||
openfile->current->lineno +
|
backup_lines(openfile->current, full_justify ?
|
||||||
|
(openfile->filebot->lineno - openfile->current->lineno +
|
||||||
(openfile->filebot->data[0] != '\0') ? 1 : 0) :
|
(openfile->filebot->data[0] != '\0') ? 1 : 0) :
|
||||||
par_len);
|
par_len);
|
||||||
|
first_par_line = openfile->current;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize indent_string to a blank string. */
|
/* Initialize indent_string to a blank string. */
|
||||||
indent_string = mallocstrcpy(NULL, "");
|
indent_string = mallocstrcpy(NULL, "");
|
||||||
|
|
Loading…
Reference in New Issue