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

master
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 the mark was set, restore the viewport and cursor position. */
if (mark_is_set) { if (mark_is_set) {
openfile->edittop = fsfromline(is_edittop_lineno); openfile->edittop = line_from_number(is_edittop_lineno);
openfile->firstcolumn = is_firstcolumn; openfile->firstcolumn = is_firstcolumn;
openfile->current = fsfromline(is_current_lineno); openfile->current = line_from_number(is_current_lineno);
openfile->current_x = is_current_x; openfile->current_x = is_current_x;
} else } else
focusing = FALSE; focusing = FALSE;

View File

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