diff --git a/ChangeLog b/ChangeLog index 4f3d31f2..506a4477 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,16 @@ CVS code - +- cut.c: + do_uncut_text() + - Fix renumbering bug when uncutting marked test at filebot. + - Fix screen not being displayed when we are uncutting marked + text at editbot (Bug discovered by Ken Tyler). - files.c: write_file() - Change open call flags, basically copy joe's way of doing it so a more recent version will actually be included in (un)stable. +- nano.c: + renumber() + - Dont stupidly assign the value of prev->lineno if prev == NULL! nano 0.9.23 - 12/08/2000 General diff --git a/cut.c b/cut.c index e7f6aa80..4b9fc1ae 100644 --- a/cut.c +++ b/cut.c @@ -271,7 +271,7 @@ int do_cut_text(void) int do_uncut_text(void) { - filestruct *tmp = current, *fileptr = current, *newbuf, *newend; + filestruct *tmp = current, *hold = current, *fileptr = current, *newbuf, *newend; #ifndef NANO_SMALL char *tmpstr, *tmpstr2; #endif @@ -339,8 +339,12 @@ int do_uncut_text(void) if (tmp != NULL) tmp->prev = newend; - else + else { + /* Fix the editbot pointer too */ + if (editbot == filebot) + editbot = newend; filebot = newend; + } /* Now why don't we update the totsize also */ for (tmp = current->next; tmp != newend; tmp = tmp->next) @@ -368,7 +372,9 @@ int do_uncut_text(void) current_x = 0; placewewant = 0; } - renumber(current->prev); + /* Renumber from BEFORE where we pasted ;) */ + renumber(hold); + dump_buffer(fileage); dump_buffer(cutbuffer); set_modified(); diff --git a/nano.c b/nano.c index e7893fd5..8e1b79e8 100644 --- a/nano.c +++ b/nano.c @@ -315,7 +315,10 @@ int renumber(filestruct * fileptr) return 0; } for (temp = fileptr; temp != NULL; temp = temp->next) { - temp->lineno = temp->prev->lineno + 1; + if (temp->prev != NULL) + temp->lineno = temp->prev->lineno + 1; + else + temp->lineno = 1; } return 0;