diff --git a/src/cut.c b/src/cut.c index 94f70f23..20718eed 100644 --- a/src/cut.c +++ b/src/cut.c @@ -91,7 +91,7 @@ void do_deletion(undo_type action) } #endif unlink_node(joining); - renumber(openfile->current); + renumber_from(openfile->current); /* Two lines were joined, so we need to refresh the screen. */ refresh_needed = TRUE; diff --git a/src/history.c b/src/history.c index d3822e60..a668aade 100644 --- a/src/history.c +++ b/src/history.c @@ -119,7 +119,7 @@ void update_history(linestruct **item, const char *text) *htop = after; unlink_node(thesame); - renumber(after); + renumber_from(after); } /* If the history is full, delete the oldest item (the one at the @@ -129,7 +129,7 @@ void update_history(linestruct **item, const char *text) *htop = (*htop)->next; unlink_node(oldest); - renumber(*htop); + renumber_from(*htop); } /* Store the fresh string in the last item, then create a new item. */ diff --git a/src/nano.c b/src/nano.c index e28ca610..6da8a90b 100644 --- a/src/nano.c +++ b/src/nano.c @@ -180,8 +180,8 @@ void free_lines(linestruct *src) delete_node(src); } -/* Renumber the lines in a buffer, starting with the given line. */ -void renumber(linestruct *line) +/* Renumber the lines in a buffer, from the given line onwards. */ +void renumber_from(linestruct *line) { ssize_t number = (line->prev == NULL) ? 0 : line->prev->lineno; @@ -319,7 +319,7 @@ void extract_buffer(linestruct **buffer_top, linestruct **buffer_bot, if (*buffer_top == NULL) { *buffer_top = openfile->filetop; *buffer_bot = openfile->filebot; - renumber(*buffer_top); + renumber_from(*buffer_top); } else { linestruct *was_bottom = *buffer_bot; @@ -342,7 +342,7 @@ void extract_buffer(linestruct **buffer_top, linestruct **buffer_bot, *buffer_bot = openfile->filebot; } - renumber(was_bottom); + renumber_from(was_bottom); } /* Since the text has now been saved, remove it from the file buffer. */ @@ -378,7 +378,7 @@ void extract_buffer(linestruct **buffer_top, linestruct **buffer_bot, } /* Renumber, starting with the beginning line of the old partition. */ - renumber(top_save); + renumber_from(top_save); /* If the text doesn't end with a newline, and it should, add one. */ if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0') @@ -454,7 +454,7 @@ void ingraft_buffer(linestruct *somebuffer) unpartition_buffer(&filepart); /* Renumber, starting with the beginning line of the old partition. */ - renumber(top_save); + renumber_from(top_save); /* If the text doesn't end with a newline, and it should, add one. */ if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0') diff --git a/src/proto.h b/src/proto.h index a15f9b19..a301f5da 100644 --- a/src/proto.h +++ b/src/proto.h @@ -397,7 +397,7 @@ void unlink_node(linestruct *fileptr); void delete_node(linestruct *fileptr); linestruct *copy_buffer(const linestruct *src); void free_lines(linestruct *src); -void renumber(linestruct *line); +void renumber_from(linestruct *line); partition *partition_buffer(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x); void unpartition_buffer(partition **p); diff --git a/src/text.c b/src/text.c index 9fa70bd5..ee059bb2 100644 --- a/src/text.c +++ b/src/text.c @@ -554,7 +554,7 @@ void do_undo(void) strlen(&u->strdata[from_x]) + 1); strcat(f->data, &u->strdata[from_x]); unlink_node(f->next); - renumber(f); + renumber_from(f); goto_line_posx(u->lineno, to_x); break; case BACK: @@ -584,7 +584,7 @@ void do_undo(void) free(f->data); f->data = data; splice_node(f, t); - renumber(t); + renumber_from(t); goto_line_posx(u->lineno, u->begin); break; case REPLACE: @@ -729,7 +729,7 @@ void do_redo(void) free(f->data); f->data = data; splice_node(f, shoveline); - renumber(shoveline); + renumber_from(shoveline); goto_line_posx(u->lineno + 1, u->mark_begin_x); break; case BACK: @@ -754,7 +754,7 @@ void do_redo(void) f->data = charealloc(f->data, strlen(f->data) + strlen(u->strdata) + 1); strcat(f->data, u->strdata); unlink_node(f->next); - renumber(f); + renumber_from(f); goto_line_posx(u->mark_begin_lineno, u->mark_begin_x); break; case REPLACE: @@ -903,7 +903,7 @@ void do_enter(void) /* Insert the newly created line after the current one and renumber. */ splice_node(openfile->current, newnode); - renumber(newnode); + renumber_from(newnode); /* Put the cursor on the new line, after any automatic whitespace. */ openfile->current = newnode;