formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2129 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
d994ad5284
Коммит
6e738ac712
37
src/nano.c
37
src/nano.c
@ -2851,8 +2851,10 @@ void do_justify(bool full_justify)
|
|||||||
if (display_len > fill) {
|
if (display_len > fill) {
|
||||||
/* The line is too long. Try to wrap it to the next. */
|
/* The line is too long. Try to wrap it to the next. */
|
||||||
break_pos = break_line(current->data + indent_len,
|
break_pos = break_line(current->data + indent_len,
|
||||||
fill - strnlenpt(current->data, indent_len), TRUE);
|
fill - strnlenpt(current->data, indent_len),
|
||||||
if (break_pos == -1 || break_pos + indent_len == line_len)
|
TRUE);
|
||||||
|
if (break_pos == -1 || break_pos + indent_len ==
|
||||||
|
line_len)
|
||||||
/* We can't break the line, or don't need to, so
|
/* We can't break the line, or don't need to, so
|
||||||
* just go on to the next. */
|
* just go on to the next. */
|
||||||
goto continue_loc;
|
goto continue_loc;
|
||||||
@ -2862,7 +2864,8 @@ void do_justify(bool full_justify)
|
|||||||
/* There is no next line in this paragraph. We make
|
/* There is no next line in this paragraph. We make
|
||||||
* a new line and copy text after break_pos into
|
* a new line and copy text after break_pos into
|
||||||
* it. */
|
* it. */
|
||||||
splice_node(current, make_new_node(current), current->next);
|
splice_node(current, make_new_node(current),
|
||||||
|
current->next);
|
||||||
/* In a non-quoted paragraph, we copy the indent
|
/* In a non-quoted paragraph, we copy the indent
|
||||||
* only if AUTOINDENT is turned on. */
|
* only if AUTOINDENT is turned on. */
|
||||||
if (quote_len == 0
|
if (quote_len == 0
|
||||||
@ -2871,9 +2874,10 @@ void do_justify(bool full_justify)
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
indent_len = 0;
|
indent_len = 0;
|
||||||
current->next->data = charalloc(indent_len + line_len -
|
current->next->data = charalloc(indent_len +
|
||||||
break_pos);
|
line_len - break_pos);
|
||||||
strncpy(current->next->data, current->data, indent_len);
|
strncpy(current->next->data, current->data,
|
||||||
|
indent_len);
|
||||||
strcpy(current->next->data + indent_len,
|
strcpy(current->next->data + indent_len,
|
||||||
current->data + break_pos + 1);
|
current->data + break_pos + 1);
|
||||||
assert(strlen(current->next->data) ==
|
assert(strlen(current->next->data) ==
|
||||||
@ -2886,12 +2890,13 @@ void do_justify(bool full_justify)
|
|||||||
|
|
||||||
indent_len = quote_len +
|
indent_len = quote_len +
|
||||||
indent_length(current->next->data + quote_len);
|
indent_length(current->next->data + quote_len);
|
||||||
current->next->data = charealloc(current->next->data,
|
current->next->data =
|
||||||
next_line_len + line_len - break_pos + 1);
|
charealloc(current->next->data, next_line_len +
|
||||||
|
line_len - break_pos + 1);
|
||||||
|
|
||||||
charmove(current->next->data + indent_len + line_len -
|
charmove(current->next->data + indent_len +
|
||||||
break_pos, current->next->data + indent_len,
|
line_len - break_pos, current->next->data +
|
||||||
next_line_len - indent_len + 1);
|
indent_len, next_line_len - indent_len + 1);
|
||||||
strcpy(current->next->data + indent_len,
|
strcpy(current->next->data + indent_len,
|
||||||
current->data + break_pos + 1);
|
current->data + break_pos + 1);
|
||||||
current->next->data[indent_len + line_len -
|
current->next->data[indent_len + line_len -
|
||||||
@ -2905,7 +2910,8 @@ void do_justify(bool full_justify)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
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 + 1 - indent_len;
|
||||||
}
|
}
|
||||||
@ -2971,7 +2977,8 @@ void do_justify(bool full_justify)
|
|||||||
charmove(current->next->data + indent_len,
|
charmove(current->next->data + indent_len,
|
||||||
current->next->data + indent_len + break_pos + 1,
|
current->next->data + indent_len + break_pos + 1,
|
||||||
next_line_len - break_pos - indent_len);
|
next_line_len - break_pos - indent_len);
|
||||||
null_at(¤t->next->data, next_line_len - break_pos);
|
null_at(¤t->next->data, next_line_len -
|
||||||
|
break_pos);
|
||||||
|
|
||||||
/* Go to the next line. */
|
/* Go to the next line. */
|
||||||
current = current->next;
|
current = current->next;
|
||||||
@ -2999,8 +3006,8 @@ void do_justify(bool full_justify)
|
|||||||
totsize++;
|
totsize++;
|
||||||
} else if (par_len == 1 &&
|
} else if (par_len == 1 &&
|
||||||
current->prev->data[prev_line_len - 1] == ' ') {
|
current->prev->data[prev_line_len - 1] == ' ') {
|
||||||
current->prev->data = charealloc(current->prev->data,
|
current->prev->data =
|
||||||
prev_line_len);
|
charealloc(current->prev->data, prev_line_len);
|
||||||
current->prev->data[prev_line_len - 1] = '\0';
|
current->prev->data[prev_line_len - 1] = '\0';
|
||||||
totsize--;
|
totsize--;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user