openfile->current->data = charealloc(openfile->current->data,
strlen(openfile->current->data) + strlen(foo->data) + 1);
strcat(openfile->current->data, foo->data);
+
#ifndef NANO_TINY
if (openfile->mark_set &&
openfile->mark_begin == openfile->current->next) {
openfile->mark_begin_x += openfile->current_x;
}
#endif
-
unlink_node(foo);
renumber(openfile->current);
openfile->totsize--;
for (i = 0; i < par_len - 1; i++) {
filestruct *next_line = openfile->current->next;
size_t line_len = strlen(openfile->current->data);
- size_t next_line_len =
- strlen(openfile->current->next->data);
+ size_t next_line_len = strlen(openfile->current->next->data);
indent_len = quote_len +
- indent_length(openfile->current->next->data +
- quote_len);
+ indent_length(openfile->current->next->data + quote_len);
next_line_len -= indent_len;
openfile->totsize -= indent_len;
/* We're just about to tack the next line onto this one. If
* this line isn't empty, make sure it ends in a space. */
if (line_len > 0 &&
- openfile->current->data[line_len - 1] != ' ') {
+ openfile->current->data[line_len - 1] != ' ') {
line_len++;
openfile->current->data =
- charealloc(openfile->current->data,
- line_len + 1);
+ charealloc(openfile->current->data, line_len + 1);
openfile->current->data[line_len - 1] = ' ';
openfile->current->data[line_len] = '\0';
openfile->totsize++;
}
- openfile->current->data =
- charealloc(openfile->current->data, line_len +
- next_line_len + 1);
- strcat(openfile->current->data, next_line->data +
- indent_len);
-
- /* Don't destroy edittop! */
- if (next_line == openfile->edittop)
- openfile->edittop = openfile->current;
+ openfile->current->data = charealloc(openfile->current->data,
+ line_len + next_line_len + 1);
+ strcat(openfile->current->data, next_line->data + indent_len);
#ifndef NANO_TINY
- /* Adjust the mark coordinates to compensate for the change
- * in the next line. */
- if (openfile->mark_set && openfile->mark_begin ==
- next_line) {
+ /* If needed, adjust the coordinates of the mark. */
+ if (openfile->mark_set &&
+ openfile->mark_begin == next_line) {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x += line_len - indent_len;
}
#endif
+ /* Don't destroy edittop! */
+ if (next_line == openfile->edittop)
+ openfile->edittop = openfile->current;
unlink_node(next_line);
justify_format(openfile->current, quote_len +
indent_length(openfile->current->data + quote_len));
- while (par_len > 0 && strlenpt(openfile->current->data) >
- fill) {
+ while (par_len > 0 && strlenpt(openfile->current->data) > fill) {
size_t line_len = strlen(openfile->current->data);
indent_len = strlen(indent_string);
assert(break_pos <= line_len);
- /* Insert a new line after the current one. */
- splice_node(openfile->current, make_new_node(openfile->current));
-
/* If this paragraph is non-quoted, and autoindent isn't
* turned on, set the indentation length to zero so that the
* indentation is treated as part of the line. */
)
indent_len = 0;
+ /* Insert a new line after the current one. */
+ splice_node(openfile->current, make_new_node(openfile->current));
+
/* Copy the text after where we're going to break the
* current line to the next line. */
openfile->current->next->data = charalloc(indent_len + 1 +
#ifndef NANO_TINY
/* Adjust the mark coordinates to compensate for the change
* in the current line. */
- if (openfile->mark_set && openfile->mark_begin ==
- openfile->current && openfile->mark_begin_x >
- break_pos) {
+ if (openfile->mark_set &&
+ openfile->mark_begin == openfile->current &&
+ openfile->mark_begin_x > break_pos) {
openfile->mark_begin = openfile->current->next;
openfile->mark_begin_x -= break_pos - indent_len;
}