tweaks: rename a function, to better indicate what it does

master
Benno Schulenberg 2019-04-30 10:27:10 +02:00
parent 208995e4a7
commit 17aa9371b5
5 changed files with 15 additions and 15 deletions

View File

@ -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;

View File

@ -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. */

View File

@ -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')

View File

@ -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);

View File

@ -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;