commit 93edd12099c5b94c904ce0d6d4f244e6f9c78c18
parent 9a475bf2d377c253a58b35db2966aac03fb953fc
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 24 May 2019 18:56:34 +0200
tweaks: rename a function, to be clearer and to stop using an old abbrev
Diffstat:
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/cut.c b/src/cut.c
@@ -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;
diff --git a/src/proto.h b/src/proto.h
@@ -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. */
diff --git a/src/text.c b/src/text.c
@@ -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);
diff --git a/src/utils.c b/src/utils.c
@@ -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;