tweaks: rename a function, to be clearer and to stop using an old abbrev

This commit is contained in:
Benno Schulenberg 2019-05-24 18:56:34 +02:00
parent 9a475bf2d3
commit 93edd12099
4 changed files with 13 additions and 13 deletions

View File

@ -416,9 +416,9 @@ void copy_text(void)
/* If the mark was set, restore the viewport and cursor position. */
if (mark_is_set) {
openfile->edittop = fsfromline(is_edittop_lineno);
openfile->edittop = line_from_number(is_edittop_lineno);
openfile->firstcolumn = is_firstcolumn;
openfile->current = fsfromline(is_current_lineno);
openfile->current = line_from_number(is_current_lineno);
openfile->current_x = is_current_x;
} else
focusing = FALSE;

View File

@ -588,7 +588,7 @@ void get_range(const linestruct **top, const linestruct **bot);
#endif
size_t get_totsize(const linestruct *begin, const linestruct *end);
#ifndef NANO_TINY
linestruct *fsfromline(ssize_t lineno);
linestruct *line_from_number(ssize_t lineno);
#endif
/* Most functions in winio.c. */

View File

@ -268,7 +268,7 @@ void do_unindent(void)
void handle_indent_action(undo *u, bool undoing, bool add_indent)
{
undo_group *group = u->grouping;
linestruct *line = fsfromline(group->top_line);
linestruct *line = line_from_number(group->top_line);
if (group->next != NULL)
statusline(ALERT, "Multiple groups -- please report a bug");
@ -440,7 +440,7 @@ void handle_comment_action(undo *u, bool undoing, bool add_comment)
goto_line_posx(u->lineno, u->begin);
while (group) {
linestruct *f = fsfromline(group->top_line);
linestruct *f = line_from_number(group->top_line);
while (f && f->lineno <= group->bottom_line) {
comment_line(undoing ^ add_comment ?
@ -500,7 +500,7 @@ void redo_cut(undo *u)
cutbuffer = NULL;
openfile->mark = fsfromline(u->mark_begin_lineno);
openfile->mark = line_from_number(u->mark_begin_lineno);
openfile->mark_x = (u->xflags & WAS_WHOLE_LINE) ? 0 : u->mark_begin_x;
do_cut_text(FALSE, TRUE, FALSE, u->type == ZAP);
@ -524,7 +524,7 @@ void do_undo(void)
}
if (u->type <= REPLACE) {
f = fsfromline(u->mark_begin_lineno);
f = line_from_number(u->mark_begin_lineno);
if (f == NULL)
return;
}
@ -621,7 +621,7 @@ void do_undo(void)
undidmsg = _("insertion");
oldcutbuffer = cutbuffer;
cutbuffer = NULL;
openfile->mark = fsfromline(u->mark_begin_lineno);
openfile->mark = line_from_number(u->mark_begin_lineno);
openfile->mark_x = u->mark_begin_x;
goto_line_posx(u->lineno, u->begin);
cut_marked(NULL);
@ -696,7 +696,7 @@ void do_redo(void)
u = u->next;
if (u->type <= REPLACE) {
f = fsfromline(u->mark_begin_lineno);
f = line_from_number(u->mark_begin_lineno);
if (f == NULL)
return;
}
@ -2149,10 +2149,10 @@ void do_justify(bool full_justify)
/* If we justified marked text, restore mark or cursor position. */
if (openfile->mark) {
if (right_side_up) {
openfile->mark = fsfromline(was_top_lineno);
openfile->mark = line_from_number(was_top_lineno);
openfile->mark_x = was_top_x;
} else {
openfile->current = fsfromline(was_top_lineno);
openfile->current = line_from_number(was_top_lineno);
openfile->current_x = was_top_x;
}
update_undo(COUPLE_END);
@ -2597,7 +2597,7 @@ const char *do_alt_speller(char *tempfile_name)
openfile->mark_x = openfile->current_x;
/* Restore the mark. */
openfile->mark = fsfromline(was_mark_lineno);
openfile->mark = line_from_number(was_mark_lineno);
} else
#endif
replaced = replace_buffer(tempfile_name, CUT_TO_EOF, FALSE);

View File

@ -496,7 +496,7 @@ void get_range(const linestruct **top, const linestruct **bot)
}
/* Given a line number, return a pointer to the corresponding struct. */
linestruct *fsfromline(ssize_t lineno)
linestruct *line_from_number(ssize_t lineno)
{
linestruct *f = openfile->current;