tweaks: slightly rename four functions, for aptness and variety

master
Benno Schulenberg 2017-12-26 14:15:49 +01:00
parent 62ebd93579
commit f9ebf038e0
5 changed files with 44 additions and 44 deletions

View File

@ -219,9 +219,9 @@ char *do_browser(char *path)
width + filelist_len - width; width + filelist_len - width;
else else
selected += editwinrows * width; selected += editwinrows * width;
} else if (func == do_first_file) { } else if (func == to_first_file) {
selected = 0; selected = 0;
} else if (func == do_last_file) { } else if (func == to_last_file) {
selected = filelist_len - 1; selected = filelist_len - 1;
} else if (func == goto_dir_void) { } else if (func == goto_dir_void) {
/* Ask for the directory to go to. */ /* Ask for the directory to go to. */
@ -785,13 +785,13 @@ void do_fileresearch(bool forwards)
} }
/* Select the first file in the list. */ /* Select the first file in the list. */
void do_first_file(void) void to_first_file(void)
{ {
selected = 0; selected = 0;
} }
/* Select the last file in the list. */ /* Select the last file in the list. */
void do_last_file(void) void to_last_file(void)
{ {
selected = filelist_len - 1; selected = filelist_len - 1;
} }

View File

@ -895,9 +895,9 @@ void shortcut_init(void)
add_to_funcs(do_page_down, MMAIN|MHELP, add_to_funcs(do_page_down, MMAIN|MHELP,
nextpage_tag, WITHORSANS(nextpage_gist), TOGETHER, VIEW); nextpage_tag, WITHORSANS(nextpage_gist), TOGETHER, VIEW);
add_to_funcs(do_first_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, add_to_funcs(to_first_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
N_("First Line"), WITHORSANS(firstline_gist), TOGETHER, VIEW); N_("First Line"), WITHORSANS(firstline_gist), TOGETHER, VIEW);
add_to_funcs(do_last_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, add_to_funcs(to_last_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
N_("Last Line"), WITHORSANS(lastline_gist), BLANKAFTER, VIEW); N_("Last Line"), WITHORSANS(lastline_gist), BLANKAFTER, VIEW);
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
@ -1053,9 +1053,9 @@ void shortcut_init(void)
add_to_funcs(do_page_down, MBROWSER, add_to_funcs(do_page_down, MBROWSER,
nextpage_tag, WITHORSANS(nextpage_gist), TOGETHER, VIEW); nextpage_tag, WITHORSANS(nextpage_gist), TOGETHER, VIEW);
add_to_funcs(do_first_file, MBROWSER|MWHEREISFILE, add_to_funcs(to_first_file, MBROWSER|MWHEREISFILE,
N_("First File"), WITHORSANS(firstfile_gist), TOGETHER, VIEW); N_("First File"), WITHORSANS(firstfile_gist), TOGETHER, VIEW);
add_to_funcs(do_last_file, MBROWSER|MWHEREISFILE, add_to_funcs(to_last_file, MBROWSER|MWHEREISFILE,
N_("Last File"), WITHORSANS(lastfile_gist), BLANKAFTER, VIEW); N_("Last File"), WITHORSANS(lastfile_gist), BLANKAFTER, VIEW);
#ifndef NANO_TINY #ifndef NANO_TINY
add_to_funcs(do_prev_word_void, MBROWSER, add_to_funcs(do_prev_word_void, MBROWSER,
@ -1134,12 +1134,12 @@ void shortcut_init(void)
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", 0, do_page_down, 0); add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", 0, do_page_down, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", 0, do_page_down, 0); add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", 0, do_page_down, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", KEY_NPAGE, do_page_down, 0); add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", KEY_NPAGE, do_page_down, 0);
add_to_sclist(MMAIN|MHELP, "M-\\", 0, do_first_line, 0); add_to_sclist(MMAIN|MHELP, "M-\\", 0, to_first_line, 0);
add_to_sclist(MMAIN|MHELP, "^Home", CONTROL_HOME, do_first_line, 0); add_to_sclist(MMAIN|MHELP, "^Home", CONTROL_HOME, to_first_line, 0);
add_to_sclist(MMAIN|MHELP, "M-|", 0, do_first_line, 0); add_to_sclist(MMAIN|MHELP, "M-|", 0, to_first_line, 0);
add_to_sclist(MMAIN|MHELP, "M-/", 0, do_last_line, 0); add_to_sclist(MMAIN|MHELP, "M-/", 0, to_last_line, 0);
add_to_sclist(MMAIN|MHELP, "^End", CONTROL_END, do_last_line, 0); add_to_sclist(MMAIN|MHELP, "^End", CONTROL_END, to_last_line, 0);
add_to_sclist(MMAIN|MHELP, "M-?", 0, do_last_line, 0); add_to_sclist(MMAIN|MHELP, "M-?", 0, to_last_line, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "M-W", 0, do_research, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "M-W", 0, do_research, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "F16", 0, do_research, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "F16", 0, do_research, 0);
#ifndef NANO_TINY #ifndef NANO_TINY
@ -1284,8 +1284,8 @@ void shortcut_init(void)
add_to_sclist(MWHEREIS|MREPLACE, "M-R", 0, regexp_void, 0); add_to_sclist(MWHEREIS|MREPLACE, "M-R", 0, regexp_void, 0);
add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0); add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0);
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0); add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MFINDINHELP, "^Y", 0, do_first_line, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MFINDINHELP, "^Y", 0, to_first_line, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MFINDINHELP, "^V", 0, do_last_line, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MFINDINHELP, "^V", 0, to_last_line, 0);
#ifdef ENABLE_JUSTIFY #ifdef ENABLE_JUSTIFY
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^W", 0, do_para_begin_void, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^W", 0, do_para_begin_void, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^O", 0, do_para_end_void, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^O", 0, do_para_end_void, 0);
@ -1307,16 +1307,16 @@ void shortcut_init(void)
} }
#endif #endif
#ifdef ENABLE_BROWSER #ifdef ENABLE_BROWSER
add_to_sclist(MWHEREISFILE, "^Y", 0, do_first_file, 0); add_to_sclist(MWHEREISFILE, "^Y", 0, to_first_file, 0);
add_to_sclist(MWHEREISFILE, "^V", 0, do_last_file, 0); add_to_sclist(MWHEREISFILE, "^V", 0, to_last_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", 0, do_first_file, 0); add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", 0, to_first_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", 0, do_last_file, 0); add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", 0, to_last_file, 0);
add_to_sclist(MBROWSER, "Home", KEY_HOME, do_first_file, 0); add_to_sclist(MBROWSER, "Home", KEY_HOME, to_first_file, 0);
add_to_sclist(MBROWSER, "End", KEY_END, do_last_file, 0); add_to_sclist(MBROWSER, "End", KEY_END, to_last_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", 0, do_first_file, 0); add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", 0, to_first_file, 0);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", 0, do_last_file, 0); add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", 0, to_last_file, 0);
add_to_sclist(MBROWSER, "^Home", CONTROL_HOME, do_first_file, 0); add_to_sclist(MBROWSER, "^Home", CONTROL_HOME, to_first_file, 0);
add_to_sclist(MBROWSER, "^End", CONTROL_END, do_last_file, 0); add_to_sclist(MBROWSER, "^End", CONTROL_END, to_last_file, 0);
add_to_sclist(MBROWSER, "^_", 0, goto_dir_void, 0); add_to_sclist(MBROWSER, "^_", 0, goto_dir_void, 0);
add_to_sclist(MBROWSER, "M-G", 0, goto_dir_void, 0); add_to_sclist(MBROWSER, "M-G", 0, goto_dir_void, 0);
add_to_sclist(MBROWSER, "F13", 0, goto_dir_void, 0); add_to_sclist(MBROWSER, "F13", 0, goto_dir_void, 0);
@ -1353,8 +1353,8 @@ void shortcut_init(void)
#ifdef ENABLE_HELP #ifdef ENABLE_HELP
add_to_sclist(MHELP, "^G", 0, do_exit, 0); add_to_sclist(MHELP, "^G", 0, do_exit, 0);
add_to_sclist(MHELP, "F1", 0, do_exit, 0); add_to_sclist(MHELP, "F1", 0, do_exit, 0);
add_to_sclist(MHELP, "Home", KEY_HOME, do_first_line, 0); add_to_sclist(MHELP, "Home", KEY_HOME, to_first_line, 0);
add_to_sclist(MHELP, "End", KEY_END, do_last_line, 0); add_to_sclist(MHELP, "End", KEY_END, to_last_line, 0);
#endif #endif
#ifdef DEBUG #ifdef DEBUG
@ -1591,9 +1591,9 @@ sc *strtosc(const char *input)
!strcasecmp(input, "nextpage")) !strcasecmp(input, "nextpage"))
s->scfunc = do_page_down; s->scfunc = do_page_down;
else if (!strcasecmp(input, "firstline")) else if (!strcasecmp(input, "firstline"))
s->scfunc = do_first_line; s->scfunc = to_first_line;
else if (!strcasecmp(input, "lastline")) else if (!strcasecmp(input, "lastline"))
s->scfunc = do_last_line; s->scfunc = to_last_line;
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
else if (!strcasecmp(input, "prevbuf")) else if (!strcasecmp(input, "prevbuf"))
s->scfunc = switch_to_prev_buffer; s->scfunc = switch_to_prev_buffer;
@ -1658,9 +1658,9 @@ sc *strtosc(const char *input)
else if (!strcasecmp(input, "gotodir")) else if (!strcasecmp(input, "gotodir"))
s->scfunc = goto_dir_void; s->scfunc = goto_dir_void;
else if (!strcasecmp(input, "firstfile")) else if (!strcasecmp(input, "firstfile"))
s->scfunc = do_first_file; s->scfunc = to_first_file;
else if (!strcasecmp(input, "lastfile")) else if (!strcasecmp(input, "lastfile"))
s->scfunc = do_last_file; s->scfunc = to_last_file;
#endif #endif
else { else {
#ifndef NANO_TINY #ifndef NANO_TINY

View File

@ -201,10 +201,10 @@ void do_help(void)
do_page_up(); do_page_up();
} else if (func == do_page_down) { } else if (func == do_page_down) {
do_page_down(); do_page_down();
} else if (func == do_first_line) { } else if (func == to_first_line) {
do_first_line(); to_first_line();
} else if (func == do_last_line) { } else if (func == to_last_line) {
do_last_line(); to_last_line();
} else if (func == do_search_forward) { } else if (func == do_search_forward) {
do_search(); do_search();
bottombars(MHELP); bottombars(MHELP);

View File

@ -24,7 +24,7 @@
#include <string.h> #include <string.h>
/* Move to the first line of the file. */ /* Move to the first line of the file. */
void do_first_line(void) void to_first_line(void)
{ {
openfile->current = openfile->fileage; openfile->current = openfile->fileage;
openfile->current_x = 0; openfile->current_x = 0;
@ -34,7 +34,7 @@ void do_first_line(void)
} }
/* Move to the last line of the file. */ /* Move to the last line of the file. */
void do_last_line(void) void to_last_line(void)
{ {
openfile->current = openfile->filebot; openfile->current = openfile->filebot;
openfile->current_x = strlen(openfile->filebot->data); openfile->current_x = strlen(openfile->filebot->data);
@ -128,7 +128,7 @@ void do_page_up(void)
/* Move up the required number of lines or chunks. If we can't, we're /* Move up the required number of lines or chunks. If we can't, we're
* at the top of the file, so put the cursor there and get out. */ * at the top of the file, so put the cursor there and get out. */
if (go_back_chunks(mustmove, &openfile->current, &leftedge) > 0) { if (go_back_chunks(mustmove, &openfile->current, &leftedge) > 0) {
do_first_line(); to_first_line();
return; return;
} }
@ -158,7 +158,7 @@ void do_page_down(void)
/* Move down the required number of lines or chunks. If we can't, we're /* Move down the required number of lines or chunks. If we can't, we're
* at the bottom of the file, so put the cursor there and get out. */ * at the bottom of the file, so put the cursor there and get out. */
if (go_forward_chunks(mustmove, &openfile->current, &leftedge) > 0) { if (go_forward_chunks(mustmove, &openfile->current, &leftedge) > 0) {
do_last_line(); to_last_line();
return; return;
} }

View File

@ -189,8 +189,8 @@ void browser_refresh(void);
void browser_select_dirname(const char *needle); void browser_select_dirname(const char *needle);
void do_filesearch(void); void do_filesearch(void);
void do_fileresearch(bool forwards); void do_fileresearch(bool forwards);
void do_first_file(void); void to_first_file(void);
void do_last_file(void); void to_last_file(void);
char *strip_last_component(const char *path); char *strip_last_component(const char *path);
#endif #endif
@ -366,8 +366,8 @@ bool has_old_position(const char *file, ssize_t *line, ssize_t *column);
#endif #endif
/* Most functions in move.c. */ /* Most functions in move.c. */
void do_first_line(void); void to_first_line(void);
void do_last_line(void); void to_last_line(void);
void do_page_up(void); void do_page_up(void);
void do_page_down(void); void do_page_down(void);
#ifdef ENABLE_JUSTIFY #ifdef ENABLE_JUSTIFY