diff --git a/ChangeLog b/ChangeLog
index b7e0b346dd0a8f73e63a1acbf7a2d8142f836414..362c7c52349a48e247499f0e3d6145e06ceb0910 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2014-06-21  Mark Majeres  <mark@engine12.com>
 	* src/text.c (undo_cut, add_undo): When undoing a cut-till-eof,
 	put the cursor back where the cut started, and not at the end.
+	* src/text.c (do_undo): When undoing a line break at the tail
+	of the file, make sure openfile->filebot is updated.
 
 2014-06-21  David Lawrence Ramsey  <pooka109@gmail.com>
 	* src/move.c, src/nano.c: Miscellaneous whitespace fixes, one
diff --git a/src/text.c b/src/text.c
index 8138d20a01ae8c94f15d554be97490b217f4a6bc..da4da3e1b28e1ecdb2321e5b3a47b53cc8444ea1 100644
--- a/src/text.c
+++ b/src/text.c
@@ -518,6 +518,8 @@ void do_undo(void)
 	    filestruct *foo = f->next;
 	    f->data = charealloc(f->data, strlen(f->data) + strlen(&f->next->data[u->mark_begin_x]) + 1);
 	    strcat(f->data, &f->next->data[u->mark_begin_x]);
+	    if (foo == openfile->filebot)
+		openfile->filebot = f;
 	    unlink_node(foo);
 	    delete_node(foo);
 	}