in do_justify(), move break_pos after the space earlier, as do_wrap()
does with wrap_loc, as it's more efficient git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2414 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
6b94e95ec9
commit
a853e2d650
18
src/nano.c
18
src/nano.c
|
@ -3113,9 +3113,11 @@ void do_justify(bool full_justify)
|
||||||
if (break_pos == -1 || break_pos + indent_len == line_len)
|
if (break_pos == -1 || break_pos + indent_len == line_len)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
break_pos += indent_len;
|
/* Move forward to the character after the indentation and
|
||||||
|
* just after the space. */
|
||||||
|
break_pos += indent_len + 1;
|
||||||
|
|
||||||
assert(break_pos < line_len);
|
assert(break_pos <= line_len);
|
||||||
|
|
||||||
/* Make a new line, and copy the text after where we're
|
/* Make a new line, and copy the text after where we're
|
||||||
* going to break this line to the beginning of the new
|
* going to break this line to the beginning of the new
|
||||||
|
@ -3132,11 +3134,13 @@ void do_justify(bool full_justify)
|
||||||
)
|
)
|
||||||
indent_len = 0;
|
indent_len = 0;
|
||||||
|
|
||||||
current->next->data = charalloc(indent_len + line_len -
|
/* Copy the text after where we're going to break the
|
||||||
|
* current line to the next line. */
|
||||||
|
current->next->data = charalloc(indent_len + 1 + line_len -
|
||||||
break_pos);
|
break_pos);
|
||||||
charcpy(current->next->data, indent_string, indent_len);
|
charcpy(current->next->data, indent_string, indent_len);
|
||||||
strcpy(current->next->data + indent_len, current->data +
|
strcpy(current->next->data + indent_len, current->data +
|
||||||
break_pos + 1);
|
break_pos);
|
||||||
|
|
||||||
par_len++;
|
par_len++;
|
||||||
totlines++;
|
totlines++;
|
||||||
|
@ -3147,12 +3151,12 @@ void do_justify(bool full_justify)
|
||||||
* in the current line. */
|
* in the current line. */
|
||||||
if (mark_beginbuf == current && mark_beginx > break_pos) {
|
if (mark_beginbuf == current && mark_beginx > break_pos) {
|
||||||
mark_beginbuf = current->next;
|
mark_beginbuf = current->next;
|
||||||
mark_beginx -= break_pos + 1 - indent_len;
|
mark_beginx -= break_pos - indent_len;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Break the line at the character just after the space. */
|
/* Break the current line. */
|
||||||
null_at(¤t->data, break_pos + 1);
|
null_at(¤t->data, break_pos);
|
||||||
|
|
||||||
/* Go to the next line. */
|
/* Go to the next line. */
|
||||||
par_len--;
|
par_len--;
|
||||||
|
|
Loading…
Reference in New Issue