+2015-12-08 Benno Schulenberg <bensberg@justemail.net>
+ * src/nano.c (splice_node): Make this function update 'filebot',
+ instead of doing it in four different places.
+
2015-12-07 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): Quit the loop when there is no end match.
* src/files.c (do_writeout): When --tempfile is given, make ^O not
if (afterthis->next != NULL)
afterthis->next->prev = newnode;
afterthis->next = newnode;
+
+ /* Update filebot when inserting a node at the end of file. */
+ if (openfile && openfile->filebot == afterthis)
+ openfile->filebot = newnode;
}
/* Unlink a node from the rest of the filestruct and delete it. */
free(f->data);
f->data = data;
splice_node(f, t);
- if (f == openfile->filebot)
- openfile->filebot = t;
goto_line_posx(u->lineno, u->begin);
break;
case CUT_EOF:
free(f->data);
f->data = data;
splice_node(f, shoveline);
- if (f == openfile->filebot)
- openfile->filebot = shoveline;
renumber(shoveline);
goto_line_posx(u->lineno + 1, u->mark_begin_x);
break;
openfile->current_x = extra;
splice_node(openfile->current, newnode);
-
- if (openfile->current == openfile->filebot)
- openfile->filebot = newnode;
openfile->current = newnode;
renumber(newnode);
assert(break_pos <= line_len);
- /* Make a new line, and copy the text after where we're
- * going to break this line to the beginning of the new
- * line. */
+ /* 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
/* Break the current line. */
null_at(&openfile->current->data, break_pos);
- /* If the current line is the last line of the file, move
- * the last line of the file down to the next line. */
- if (openfile->filebot == openfile->current)
- openfile->filebot = openfile->filebot->next;
-
/* Go to the next line. */
par_len--;
openfile->current_y++;