fix the last of the breakage (I hope) in find_paragraph() and
do_justify() git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3161 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
bdff665b5d
commit
d82dae0925
|
@ -41,8 +41,8 @@ CVS code -
|
||||||
always ends in a magicline. Changes to cut_line(),
|
always ends in a magicline. Changes to cut_line(),
|
||||||
do_cut_till_end(), open_buffer(), read_file(), write_file(),
|
do_cut_till_end(), open_buffer(), read_file(), write_file(),
|
||||||
do_last_line(), do_para_end(), backup_lines(),
|
do_last_line(), do_para_end(), backup_lines(),
|
||||||
find_paragraph(), do_justify() (not completely fixed yet),
|
find_paragraph(), do_justify(), do_alt_speller(), and
|
||||||
do_alt_speller(), and do_wordlinechar_count(). (DLR)
|
do_wordlinechar_count(). (DLR)
|
||||||
- Tweak a few functions to rely on fileage and filebot instead
|
- Tweak a few functions to rely on fileage and filebot instead
|
||||||
of NULL for their checks to detect the top or bottom of the
|
of NULL for their checks to detect the top or bottom of the
|
||||||
file. Changes to cut_line(), cut_to_eol(), do_page_up(),
|
file. Changes to cut_line(), cut_to_eol(), do_page_up(),
|
||||||
|
|
43
src/text.c
43
src/text.c
|
@ -1062,35 +1062,42 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* If the current line isn't in a paragraph, move forward to the
|
/* If the current line isn't in a paragraph, move forward to the
|
||||||
* line after the last line of the next paragraph, if any. If the
|
* last line of the next paragraph, if any. */
|
||||||
* line before that isn't in a paragraph, it means that there aren't
|
|
||||||
* any paragraphs left, so get out. Otherwise, move back to the
|
|
||||||
* last line of the paragraph. If the current line is in a
|
|
||||||
* paragraph and it isn't the first line of that paragraph, move
|
|
||||||
* back to the first line of the paragraph. */
|
|
||||||
if (!inpar(openfile->current)) {
|
if (!inpar(openfile->current)) {
|
||||||
current_save = openfile->current;
|
|
||||||
do_para_end(FALSE);
|
do_para_end(FALSE);
|
||||||
if (!inpar(openfile->current->prev))
|
/* If we end up past the beginning of the line, it means that
|
||||||
return FALSE;
|
* we're at the end of the last line of the file, and the line
|
||||||
if (openfile->current != openfile->fileage)
|
* isn't blank, in which case the last line of the file is the
|
||||||
openfile->current = openfile->current->prev;
|
* last line of the next paragraph.
|
||||||
|
*
|
||||||
|
* Otherwise, if we end up on a line that's in a paragraph, it
|
||||||
|
* means that we're on the line after the last line of the next
|
||||||
|
* paragraph, in which case we should move back to the last line
|
||||||
|
* of the next paragraph. */
|
||||||
|
if (openfile->current_x == 0) {
|
||||||
|
if (!inpar(openfile->current->prev))
|
||||||
|
return FALSE;
|
||||||
|
if (openfile->current != openfile->fileage)
|
||||||
|
openfile->current = openfile->current->prev;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
/* If the current line isn't the first line of the paragraph, move
|
||||||
|
* back to the first line of the paragraph. */
|
||||||
if (!begpar(openfile->current))
|
if (!begpar(openfile->current))
|
||||||
do_para_begin(FALSE);
|
do_para_begin(FALSE);
|
||||||
|
|
||||||
/* Now current is the first line of the paragraph. Set quote_len to
|
/* Now current is the first line of the paragraph. Set quote_len to
|
||||||
* the quotation length of that line, and set par_len to the number
|
* the quotation length of that line, and set par_len to the number
|
||||||
* of lines in this paragraph. If, while calculating the latter, we
|
* of lines in this paragraph. */
|
||||||
* end up past the beginning of the line, it means that we're at the
|
|
||||||
* end of the last line of the file, and the line isn't blank, in
|
|
||||||
* which case the last line of the file is part of this
|
|
||||||
* paragraph. */
|
|
||||||
quote_len = quote_length(openfile->current->data);
|
quote_len = quote_length(openfile->current->data);
|
||||||
current_save = openfile->current;
|
current_save = openfile->current;
|
||||||
current_y_save = openfile->current_y;
|
current_y_save = openfile->current_y;
|
||||||
do_para_end(FALSE);
|
do_para_end(FALSE);
|
||||||
par_len = openfile->current->lineno - current_save->lineno;
|
par_len = openfile->current->lineno - current_save->lineno;
|
||||||
|
/* If we end up past the beginning of the line, it means that we're
|
||||||
|
* at the end of the last line of the file, and the line isn't
|
||||||
|
* blank, in which case the last line of the file is part of the
|
||||||
|
* paragraph. */
|
||||||
if (openfile->current_x > 0)
|
if (openfile->current_x > 0)
|
||||||
par_len++;
|
par_len++;
|
||||||
openfile->current = current_save;
|
openfile->current = current_save;
|
||||||
|
@ -1162,11 +1169,11 @@ void do_justify(bool full_justify)
|
||||||
/* The first indentation that doesn't match the initial
|
/* The first indentation that doesn't match the initial
|
||||||
* indentation of the paragraph we justify. This is put at
|
* indentation of the paragraph we justify. This is put at
|
||||||
* the beginning of every line broken off the first
|
* the beginning of every line broken off the first
|
||||||
* justified line of the paragraph. (Note that this works
|
* justified line of the paragraph. Note that this works
|
||||||
* because a paragraph can only contain two indentations at
|
* because a paragraph can only contain two indentations at
|
||||||
* most: the initial one, and a different one starting on a
|
* most: the initial one, and a different one starting on a
|
||||||
* line after the first. See the comment at begpar() for
|
* line after the first. See the comment at begpar() for
|
||||||
* more about when a line is part of a paragraph.) */
|
* more about when a line is part of a paragraph. */
|
||||||
|
|
||||||
/* Find the first line of the paragraph to be justified. That
|
/* 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
|
* is the start of this paragraph if we're in one, or the start
|
||||||
|
|
Loading…
Reference in New Issue