diff --git a/src/text.c b/src/text.c index 7cb6b2e..54c9abb 100644 --- a/src/text.c +++ b/src/text.c @@ -502,8 +502,10 @@ void do_comment() if (file_changed) { set_modified(); refresh_needed = TRUE; - } else + } else { statusbar(_("Cannot comment past end of file")); + discard_until(openfile->undotop->next, openfile); + } } /* Test whether the given line can be uncommented, or add or remove a comment, @@ -1131,6 +1133,8 @@ void discard_until(const undo *thisitem, openfilestruct *thefile) dropit = thefile->undotop; } + thefile->current_undo = thefile->undotop; + /* Prevent a chain of editing actions from continuing. */ thefile->last_action = OTHER; }