tweaks: normalize the indentation, and remove unneeded braces
parent
877a649819
commit
932a35c072
84
src/text.c
84
src/text.c
|
@ -2045,21 +2045,21 @@ void do_justify(bool full_justify)
|
||||||
if (!openfile->mark)
|
if (!openfile->mark)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* When justifying the entire buffer, start at the top. Otherwise, when
|
/* When justifying the entire buffer, start at the top. Otherwise, when
|
||||||
* in a paragraph but not at its beginning, move back to its first line. */
|
* in a paragraph but not at its beginning, move back to its first line. */
|
||||||
if (full_justify)
|
if (full_justify)
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->fileage;
|
||||||
else if (inpar(openfile->current) && !begpar(openfile->current, 0))
|
else if (inpar(openfile->current) && !begpar(openfile->current, 0))
|
||||||
do_para_begin(&openfile->current);
|
do_para_begin(&openfile->current);
|
||||||
|
|
||||||
/* Find the first line of the paragraph(s) to be justified. If the
|
/* Find the first line of the paragraph(s) to be justified. If the
|
||||||
* search fails, there is nothing to justify, and we will be on the
|
* search fails, there is nothing to justify, and we will be on the
|
||||||
* last line of the file, so put the cursor at the end of it. */
|
* last line of the file, so put the cursor at the end of it. */
|
||||||
if (!find_paragraph(&openfile->current, &par_len)) {
|
if (!find_paragraph(&openfile->current, &par_len)) {
|
||||||
openfile->current_x = strlen(openfile->filebot->data);
|
openfile->current_x = strlen(openfile->filebot->data);
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare to put the text we want to justify in the cutbuffer. */
|
/* Prepare to put the text we want to justify in the cutbuffer. */
|
||||||
|
@ -2112,26 +2112,26 @@ void do_justify(bool full_justify)
|
||||||
size_t jus_len;
|
size_t jus_len;
|
||||||
/* The number of lines we're storing in the current cutbuffer. */
|
/* The number of lines we're storing in the current cutbuffer. */
|
||||||
|
|
||||||
/* Start out at the first line of the paragraph. */
|
/* Start out at the first line of the paragraph. */
|
||||||
first_par_line = openfile->current;
|
first_par_line = openfile->current;
|
||||||
last_par_line = openfile->current;
|
last_par_line = openfile->current;
|
||||||
|
|
||||||
/* Set the number of lines to be pulled into the cutbuffer. */
|
/* Set the number of lines to be pulled into the cutbuffer. */
|
||||||
if (full_justify) {
|
if (full_justify)
|
||||||
jus_len = openfile->filebot->lineno;
|
jus_len = openfile->filebot->lineno;
|
||||||
} else
|
else
|
||||||
jus_len = par_len;
|
jus_len = par_len;
|
||||||
|
|
||||||
/* Move down to the last line to be extracted. */
|
/* Move down to the last line to be extracted. */
|
||||||
for (; jus_len > 1; jus_len--)
|
for (; jus_len > 1; jus_len--)
|
||||||
last_par_line = last_par_line->next;
|
last_par_line = last_par_line->next;
|
||||||
|
|
||||||
/* When possible, step one line further; otherwise, to line's end. */
|
/* When possible, step one line further; otherwise, to line's end. */
|
||||||
if (last_par_line->next != NULL) {
|
if (last_par_line->next != NULL) {
|
||||||
last_par_line = last_par_line->next;
|
last_par_line = last_par_line->next;
|
||||||
bot_x = 0;
|
bot_x = 0;
|
||||||
} else
|
} else
|
||||||
bot_x = strlen(last_par_line->data);
|
bot_x = strlen(last_par_line->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
@ -2234,22 +2234,22 @@ void do_justify(bool full_justify)
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* Prepare to justify the text we just put in the cutbuffer. */
|
/* Prepare to justify the text we just put in the cutbuffer. */
|
||||||
jusline = cutbuffer;
|
jusline = cutbuffer;
|
||||||
|
|
||||||
/* Justify the current paragraph. */
|
/* Justify the current paragraph. */
|
||||||
justify_paragraph(&jusline, par_len);
|
justify_paragraph(&jusline, par_len);
|
||||||
|
|
||||||
/* When justifying the entire buffer, find and justify all paragraphs. */
|
/* When justifying the entire buffer, find and justify all paragraphs. */
|
||||||
if (full_justify) {
|
if (full_justify) {
|
||||||
while (find_paragraph(&jusline, &par_len)) {
|
while (find_paragraph(&jusline, &par_len)) {
|
||||||
justify_paragraph(&jusline, par_len);
|
justify_paragraph(&jusline, par_len);
|
||||||
|
|
||||||
if (jusline->next == NULL)
|
if (jusline->next == NULL)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
add_undo(PASTE);
|
add_undo(PASTE);
|
||||||
|
|
Loading…
Reference in New Issue