tweaks: rename a variable, away from an abbreviation
This commit is contained in:
parent
69d33ec170
commit
04a08fe6a5
@ -461,7 +461,7 @@ char *browse(char *path)
|
|||||||
titlebar(path);
|
titlebar(path);
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
functionptrtype func;
|
functionptrtype function;
|
||||||
int kbinput;
|
int kbinput;
|
||||||
|
|
||||||
lastmessage = VACUUM;
|
lastmessage = VACUUM;
|
||||||
@ -510,68 +510,68 @@ char *browse(char *path)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
func = interpret(&kbinput);
|
function = interpret(&kbinput);
|
||||||
|
|
||||||
if (func == full_refresh) {
|
if (function == full_refresh) {
|
||||||
full_refresh();
|
full_refresh();
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Simulate a terminal resize to force a directory reread. */
|
/* Simulate a terminal resize to force a directory reread. */
|
||||||
kbinput = KEY_WINCH;
|
kbinput = KEY_WINCH;
|
||||||
#endif
|
#endif
|
||||||
} else if (func == do_help) {
|
} else if (function == do_help) {
|
||||||
do_help();
|
do_help();
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* The terminal dimensions might have changed, so act as if. */
|
/* The terminal dimensions might have changed, so act as if. */
|
||||||
kbinput = KEY_WINCH;
|
kbinput = KEY_WINCH;
|
||||||
} else if (func == do_toggle) {
|
} else if (function == do_toggle) {
|
||||||
TOGGLE(NO_HELP);
|
TOGGLE(NO_HELP);
|
||||||
window_init();
|
window_init();
|
||||||
kbinput = KEY_WINCH;
|
kbinput = KEY_WINCH;
|
||||||
#endif
|
#endif
|
||||||
} else if (func == do_search_backward) {
|
} else if (function == do_search_backward) {
|
||||||
search_filename(BACKWARD);
|
search_filename(BACKWARD);
|
||||||
} else if (func == do_search_forward) {
|
} else if (function == do_search_forward) {
|
||||||
search_filename(FORWARD);
|
search_filename(FORWARD);
|
||||||
} else if (func == do_findprevious) {
|
} else if (function == do_findprevious) {
|
||||||
research_filename(BACKWARD);
|
research_filename(BACKWARD);
|
||||||
} else if (func == do_findnext) {
|
} else if (function == do_findnext) {
|
||||||
research_filename(FORWARD);
|
research_filename(FORWARD);
|
||||||
} else if (func == do_left) {
|
} else if (function == do_left) {
|
||||||
if (selected > 0)
|
if (selected > 0)
|
||||||
selected--;
|
selected--;
|
||||||
} else if (func == do_right) {
|
} else if (function == do_right) {
|
||||||
if (selected < list_length - 1)
|
if (selected < list_length - 1)
|
||||||
selected++;
|
selected++;
|
||||||
} else if (func == to_prev_word) {
|
} else if (function == to_prev_word) {
|
||||||
selected -= (selected % piles);
|
selected -= (selected % piles);
|
||||||
} else if (func == to_next_word) {
|
} else if (function == to_next_word) {
|
||||||
selected += piles - 1 - (selected % piles);
|
selected += piles - 1 - (selected % piles);
|
||||||
if (selected >= list_length)
|
if (selected >= list_length)
|
||||||
selected = list_length - 1;
|
selected = list_length - 1;
|
||||||
} else if (func == do_up) {
|
} else if (function == do_up) {
|
||||||
if (selected >= piles)
|
if (selected >= piles)
|
||||||
selected -= piles;
|
selected -= piles;
|
||||||
} else if (func == do_down) {
|
} else if (function == do_down) {
|
||||||
if (selected + piles <= list_length - 1)
|
if (selected + piles <= list_length - 1)
|
||||||
selected += piles;
|
selected += piles;
|
||||||
} else if (func == to_prev_block) {
|
} else if (function == to_prev_block) {
|
||||||
selected = ((selected / (usable_rows * piles)) * usable_rows * piles) +
|
selected = ((selected / (usable_rows * piles)) * usable_rows * piles) +
|
||||||
selected % piles;
|
selected % piles;
|
||||||
} else if (func == to_next_block) {
|
} else if (function == to_next_block) {
|
||||||
selected = ((selected / (usable_rows * piles)) * usable_rows * piles) +
|
selected = ((selected / (usable_rows * piles)) * usable_rows * piles) +
|
||||||
selected % piles + usable_rows * piles - piles;
|
selected % piles + usable_rows * piles - piles;
|
||||||
if (selected >= list_length)
|
if (selected >= list_length)
|
||||||
selected = (list_length / piles) * piles + selected % piles;
|
selected = (list_length / piles) * piles + selected % piles;
|
||||||
if (selected >= list_length)
|
if (selected >= list_length)
|
||||||
selected -= piles;
|
selected -= piles;
|
||||||
} else if (func == do_page_up) {
|
} else if (function == do_page_up) {
|
||||||
if (selected < piles)
|
if (selected < piles)
|
||||||
selected = 0;
|
selected = 0;
|
||||||
else if (selected < usable_rows * piles)
|
else if (selected < usable_rows * piles)
|
||||||
selected = selected % piles;
|
selected = selected % piles;
|
||||||
else
|
else
|
||||||
selected -= usable_rows * piles;
|
selected -= usable_rows * piles;
|
||||||
} else if (func == do_page_down) {
|
} else if (function == do_page_down) {
|
||||||
if (selected + piles >= list_length - 1)
|
if (selected + piles >= list_length - 1)
|
||||||
selected = list_length - 1;
|
selected = list_length - 1;
|
||||||
else if (selected + usable_rows * piles >= list_length)
|
else if (selected + usable_rows * piles >= list_length)
|
||||||
@ -579,11 +579,11 @@ char *browse(char *path)
|
|||||||
list_length - piles;
|
list_length - piles;
|
||||||
else
|
else
|
||||||
selected += usable_rows * piles;
|
selected += usable_rows * piles;
|
||||||
} else if (func == to_first_file) {
|
} else if (function == to_first_file) {
|
||||||
selected = 0;
|
selected = 0;
|
||||||
} else if (func == to_last_file) {
|
} else if (function == to_last_file) {
|
||||||
selected = list_length - 1;
|
selected = list_length - 1;
|
||||||
} else if (func == goto_dir) {
|
} else if (function == goto_dir) {
|
||||||
/* Ask for the directory to go to. */
|
/* Ask for the directory to go to. */
|
||||||
if (do_prompt(MGOTODIR, "", NULL,
|
if (do_prompt(MGOTODIR, "", NULL,
|
||||||
/* TRANSLATORS: This is a prompt. */
|
/* TRANSLATORS: This is a prompt. */
|
||||||
@ -622,7 +622,7 @@ char *browse(char *path)
|
|||||||
|
|
||||||
/* Try opening and reading the specified directory. */
|
/* Try opening and reading the specified directory. */
|
||||||
goto read_directory_contents;
|
goto read_directory_contents;
|
||||||
} else if (func == do_enter) {
|
} else if (function == do_enter) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
/* It isn't possible to move up from the root directory. */
|
/* It isn't possible to move up from the root directory. */
|
||||||
@ -662,14 +662,14 @@ char *browse(char *path)
|
|||||||
path = mallocstrcpy(path, filelist[selected]);
|
path = mallocstrcpy(path, filelist[selected]);
|
||||||
goto read_directory_contents;
|
goto read_directory_contents;
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
} else if (func == (functionptrtype)implant) {
|
} else if (function == (functionptrtype)implant) {
|
||||||
implant(first_sc_for(MBROWSER, func)->expansion);
|
implant(first_sc_for(MBROWSER, function)->expansion);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
} else if (kbinput == KEY_WINCH) {
|
} else if (kbinput == KEY_WINCH) {
|
||||||
; /* Gets handled below. */
|
; /* Gets handled below. */
|
||||||
#endif
|
#endif
|
||||||
} else if (func == do_exit) {
|
} else if (function == do_exit) {
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
unbound_key(kbinput);
|
unbound_key(kbinput);
|
||||||
|
|||||||
32
src/files.c
32
src/files.c
@ -1213,7 +1213,7 @@ void insert_a_file_or(bool execute)
|
|||||||
ssize_t was_current_lineno = openfile->current->lineno;
|
ssize_t was_current_lineno = openfile->current->lineno;
|
||||||
size_t was_current_x = openfile->current_x;
|
size_t was_current_x = openfile->current_x;
|
||||||
#if !defined(NANO_TINY) || defined(ENABLE_BROWSER) || defined(ENABLE_MULTIBUFFER)
|
#if !defined(NANO_TINY) || defined(ENABLE_BROWSER) || defined(ENABLE_MULTIBUFFER)
|
||||||
functionptrtype func = func_from_key(&response);
|
functionptrtype function = func_from_key(&response);
|
||||||
#endif
|
#endif
|
||||||
given = mallocstrcpy(given, answer);
|
given = mallocstrcpy(given, answer);
|
||||||
|
|
||||||
@ -1221,7 +1221,7 @@ void insert_a_file_or(bool execute)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
if (func == flip_newbuffer) {
|
if (function == flip_newbuffer) {
|
||||||
/* Allow toggling only when not in view mode. */
|
/* Allow toggling only when not in view mode. */
|
||||||
if (!ISSET(VIEW_MODE))
|
if (!ISSET(VIEW_MODE))
|
||||||
TOGGLE(MULTIBUFFER);
|
TOGGLE(MULTIBUFFER);
|
||||||
@ -1231,22 +1231,22 @@ void insert_a_file_or(bool execute)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (func == flip_convert) {
|
if (function == flip_convert) {
|
||||||
TOGGLE(NO_CONVERT);
|
TOGGLE(NO_CONVERT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (func == flip_execute) {
|
if (function == flip_execute) {
|
||||||
execute = !execute;
|
execute = !execute;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (func == flip_pipe) {
|
if (function == flip_pipe) {
|
||||||
add_or_remove_pipe_symbol_from_answer();
|
add_or_remove_pipe_symbol_from_answer();
|
||||||
given = mallocstrcpy(given, answer);
|
given = mallocstrcpy(given, answer);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_BROWSER
|
#ifdef ENABLE_BROWSER
|
||||||
if (func == to_files) {
|
if (function == to_files) {
|
||||||
char *chosen = browse_in(answer);
|
char *chosen = browse_in(answer);
|
||||||
|
|
||||||
/* If no file was chosen, go back to the prompt. */
|
/* If no file was chosen, go back to the prompt. */
|
||||||
@ -2094,7 +2094,7 @@ int write_it_out(bool exiting, bool withprompt)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
functionptrtype func;
|
functionptrtype function;
|
||||||
const char *msg;
|
const char *msg;
|
||||||
int response = 0;
|
int response = 0;
|
||||||
int choice = NO;
|
int choice = NO;
|
||||||
@ -2141,10 +2141,10 @@ int write_it_out(bool exiting, bool withprompt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
func = func_from_key(&response);
|
function = func_from_key(&response);
|
||||||
|
|
||||||
/* Upon request, abandon the buffer. */
|
/* Upon request, abandon the buffer. */
|
||||||
if (func == discard_buffer) {
|
if (function == discard_buffer) {
|
||||||
free(given);
|
free(given);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
@ -2152,7 +2152,7 @@ int write_it_out(bool exiting, bool withprompt)
|
|||||||
given = mallocstrcpy(given, answer);
|
given = mallocstrcpy(given, answer);
|
||||||
|
|
||||||
#ifdef ENABLE_BROWSER
|
#ifdef ENABLE_BROWSER
|
||||||
if (func == to_files) {
|
if (function == to_files) {
|
||||||
char *chosen = browse_in(answer);
|
char *chosen = browse_in(answer);
|
||||||
|
|
||||||
if (chosen == NULL)
|
if (chosen == NULL)
|
||||||
@ -2163,17 +2163,17 @@ int write_it_out(bool exiting, bool withprompt)
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (func == dos_format) {
|
if (function == dos_format) {
|
||||||
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE : DOS_FILE;
|
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE : DOS_FILE;
|
||||||
continue;
|
continue;
|
||||||
} else if (func == mac_format) {
|
} else if (function == mac_format) {
|
||||||
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE : MAC_FILE;
|
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE : MAC_FILE;
|
||||||
continue;
|
continue;
|
||||||
} else if (func == back_it_up) {
|
} else if (function == back_it_up) {
|
||||||
TOGGLE(MAKE_BACKUP);
|
TOGGLE(MAKE_BACKUP);
|
||||||
continue;
|
continue;
|
||||||
} else if (func == prepend_it || func == append_it) {
|
} else if (function == prepend_it || function == append_it) {
|
||||||
if (func == prepend_it)
|
if (function == prepend_it)
|
||||||
method = (method == PREPEND) ? OVERWRITE : PREPEND;
|
method = (method == PREPEND) ? OVERWRITE : PREPEND;
|
||||||
else
|
else
|
||||||
method = (method == APPEND) ? OVERWRITE : APPEND;
|
method = (method == APPEND) ? OVERWRITE : APPEND;
|
||||||
@ -2182,7 +2182,7 @@ int write_it_out(bool exiting, bool withprompt)
|
|||||||
continue;
|
continue;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (func == do_help)
|
if (function == do_help)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef ENABLE_EXTRA
|
#ifdef ENABLE_EXTRA
|
||||||
|
|||||||
14
src/global.c
14
src/global.c
@ -317,7 +317,7 @@ void discard_buffer(void) {;}
|
|||||||
void do_cancel(void) {;}
|
void do_cancel(void) {;}
|
||||||
|
|
||||||
/* Add a function to the linked list of functions. */
|
/* Add a function to the linked list of functions. */
|
||||||
void add_to_funcs(void (*func)(void), int menus, const char *desc,
|
void add_to_funcs(void (*function)(void), int menus, const char *desc,
|
||||||
const char *help, bool blank_after)
|
const char *help, bool blank_after)
|
||||||
{
|
{
|
||||||
funcstruct *f = nmalloc(sizeof(funcstruct));
|
funcstruct *f = nmalloc(sizeof(funcstruct));
|
||||||
@ -329,7 +329,7 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc,
|
|||||||
tailfunc = f;
|
tailfunc = f;
|
||||||
|
|
||||||
f->next = NULL;
|
f->next = NULL;
|
||||||
f->func = func;
|
f->func = function;
|
||||||
f->menus = menus;
|
f->menus = menus;
|
||||||
f->desc = desc;
|
f->desc = desc;
|
||||||
#ifdef ENABLE_HELP
|
#ifdef ENABLE_HELP
|
||||||
@ -385,7 +385,7 @@ int keycode_from_string(const char *keystring)
|
|||||||
|
|
||||||
/* Add a key combo to the linked list of shortcuts. */
|
/* Add a key combo to the linked list of shortcuts. */
|
||||||
void add_to_sclist(int menus, const char *scstring, const int keycode,
|
void add_to_sclist(int menus, const char *scstring, const int keycode,
|
||||||
void (*func)(void), int toggle)
|
void (*function)(void), int toggle)
|
||||||
{
|
{
|
||||||
static keystruct *tailsc;
|
static keystruct *tailsc;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
@ -402,7 +402,7 @@ void add_to_sclist(int menus, const char *scstring, const int keycode,
|
|||||||
|
|
||||||
/* Fill in the data. */
|
/* Fill in the data. */
|
||||||
sc->menus = menus;
|
sc->menus = menus;
|
||||||
sc->func = func;
|
sc->func = function;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
sc->toggle = toggle;
|
sc->toggle = toggle;
|
||||||
/* When not the same toggle as the previous one, increment the ID. */
|
/* When not the same toggle as the previous one, increment the ID. */
|
||||||
@ -416,11 +416,11 @@ void add_to_sclist(int menus, const char *scstring, const int keycode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return the first shortcut in the list of shortcuts that
|
/* Return the first shortcut in the list of shortcuts that
|
||||||
* matches the given func in the given menu. */
|
* matches the given function in the given menu. */
|
||||||
const keystruct *first_sc_for(int menu, void (*func)(void))
|
const keystruct *first_sc_for(int menu, void (*function)(void))
|
||||||
{
|
{
|
||||||
for (keystruct *sc = sclist; sc != NULL; sc = sc->next)
|
for (keystruct *sc = sclist; sc != NULL; sc = sc->next)
|
||||||
if ((sc->menus & menu) && sc->func == func && sc->keystr[0])
|
if ((sc->menus & menu) && sc->func == function && sc->keystr[0])
|
||||||
return sc;
|
return sc;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
34
src/help.c
34
src/help.c
@ -389,7 +389,7 @@ void wrap_help_text_into_buffer(void)
|
|||||||
void show_help(void)
|
void show_help(void)
|
||||||
{
|
{
|
||||||
int kbinput = ERR;
|
int kbinput = ERR;
|
||||||
functionptrtype func;
|
functionptrtype function;
|
||||||
/* The function of the key the user typed in. */
|
/* The function of the key the user typed in. */
|
||||||
int oldmenu = currmenu;
|
int oldmenu = currmenu;
|
||||||
/* The menu we were called from. */
|
/* The menu we were called from. */
|
||||||
@ -475,28 +475,28 @@ void show_help(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
func = interpret(&kbinput);
|
function = interpret(&kbinput);
|
||||||
|
|
||||||
if (func == full_refresh) {
|
if (function == full_refresh) {
|
||||||
full_refresh();
|
full_refresh();
|
||||||
} else if (ISSET(SHOW_CURSOR) && (func == do_left || func == do_right ||
|
} else if (ISSET(SHOW_CURSOR) && (function == do_left || function == do_right ||
|
||||||
func == do_up || func == do_down)) {
|
function == do_up || function == do_down)) {
|
||||||
func();
|
function();
|
||||||
} else if (func == do_up || func == do_scroll_up) {
|
} else if (function == do_up || function == do_scroll_up) {
|
||||||
do_scroll_up();
|
do_scroll_up();
|
||||||
} else if (func == do_down || func == do_scroll_down) {
|
} else if (function == do_down || function == do_scroll_down) {
|
||||||
if (openfile->edittop->lineno + editwinrows - 1 < openfile->filebot->lineno)
|
if (openfile->edittop->lineno + editwinrows - 1 < openfile->filebot->lineno)
|
||||||
do_scroll_down();
|
do_scroll_down();
|
||||||
} else if (func == do_page_up || func == do_page_down ||
|
} else if (function == do_page_up || function == do_page_down ||
|
||||||
func == to_first_line || func == to_last_line) {
|
function == to_first_line || function == to_last_line) {
|
||||||
func();
|
function();
|
||||||
} else if (func == do_search_backward || func == do_search_forward ||
|
} else if (function == do_search_backward || function == do_search_forward ||
|
||||||
func == do_findprevious || func == do_findnext) {
|
function == do_findprevious || function == do_findnext) {
|
||||||
func();
|
function();
|
||||||
bottombars(MHELP);
|
bottombars(MHELP);
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
} else if (func == (functionptrtype)implant) {
|
} else if (function == (functionptrtype)implant) {
|
||||||
implant(first_sc_for(MHELP, func)->expansion);
|
implant(first_sc_for(MHELP, function)->expansion);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MOUSE
|
#ifdef ENABLE_MOUSE
|
||||||
} else if (kbinput == KEY_MOUSE) {
|
} else if (kbinput == KEY_MOUSE) {
|
||||||
@ -507,7 +507,7 @@ void show_help(void)
|
|||||||
} else if (kbinput == KEY_WINCH) {
|
} else if (kbinput == KEY_WINCH) {
|
||||||
; /* Nothing to do. */
|
; /* Nothing to do. */
|
||||||
#endif
|
#endif
|
||||||
} else if (func == do_exit) {
|
} else if (function == do_exit) {
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
unbound_key(kbinput);
|
unbound_key(kbinput);
|
||||||
|
|||||||
44
src/prompt.c
44
src/prompt.c
@ -426,7 +426,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
const keystruct *shortcut;
|
const keystruct *shortcut;
|
||||||
functionptrtype func;
|
functionptrtype function;
|
||||||
int input;
|
int input;
|
||||||
|
|
||||||
if (typing_x > strlen(answer))
|
if (typing_x > strlen(answer))
|
||||||
@ -459,16 +459,16 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
|
|
||||||
/* Check for a shortcut in the current list. */
|
/* Check for a shortcut in the current list. */
|
||||||
shortcut = get_shortcut(&input);
|
shortcut = get_shortcut(&input);
|
||||||
func = (shortcut ? shortcut->func : NULL);
|
function = (shortcut ? shortcut->func : NULL);
|
||||||
|
|
||||||
if (func == do_cancel || func == do_enter)
|
if (function == do_cancel || function == do_enter)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* When it's a normal character, add it to the answer. */
|
/* When it's a normal character, add it to the answer. */
|
||||||
absorb_character(input, func);
|
absorb_character(input, function);
|
||||||
|
|
||||||
#ifdef ENABLE_TABCOMP
|
#ifdef ENABLE_TABCOMP
|
||||||
if (func == do_tab) {
|
if (function == do_tab) {
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
if (!previous_was_tab)
|
if (!previous_was_tab)
|
||||||
@ -487,7 +487,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
if (func == get_older_item && history_list != NULL) {
|
if (function == get_older_item && history_list != NULL) {
|
||||||
/* If this is the first step into history, start at the bottom. */
|
/* If this is the first step into history, start at the bottom. */
|
||||||
if (stored_string == NULL)
|
if (stored_string == NULL)
|
||||||
reset_history_pointer_for(*history_list);
|
reset_history_pointer_for(*history_list);
|
||||||
@ -502,7 +502,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
answer = mallocstrcpy(answer, (*history_list)->data);
|
answer = mallocstrcpy(answer, (*history_list)->data);
|
||||||
typing_x = strlen(answer);
|
typing_x = strlen(answer);
|
||||||
}
|
}
|
||||||
} else if (func == get_newer_item && history_list != NULL) {
|
} else if (function == get_newer_item && history_list != NULL) {
|
||||||
/* If there is a newer item, move to it and copy its string. */
|
/* If there is a newer item, move to it and copy its string. */
|
||||||
if ((*history_list)->next != NULL) {
|
if ((*history_list)->next != NULL) {
|
||||||
*history_list = (*history_list)->next;
|
*history_list = (*history_list)->next;
|
||||||
@ -517,33 +517,33 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* ENABLE_HISTORIES */
|
#endif /* ENABLE_HISTORIES */
|
||||||
if (func == do_help || func == full_refresh)
|
if (function == do_help || function == full_refresh)
|
||||||
func();
|
function();
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (func == do_toggle) {
|
else if (function == do_toggle) {
|
||||||
TOGGLE(NO_HELP);
|
TOGGLE(NO_HELP);
|
||||||
window_init();
|
window_init();
|
||||||
focusing = FALSE;
|
focusing = FALSE;
|
||||||
refresh_func();
|
refresh_func();
|
||||||
bottombars(currmenu);
|
bottombars(currmenu);
|
||||||
} else if (func == do_nothing)
|
} else if (function == do_nothing)
|
||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
else if (func == (functionptrtype)implant)
|
else if (function == (functionptrtype)implant)
|
||||||
implant(shortcut->expansion);
|
implant(shortcut->expansion);
|
||||||
#endif
|
#endif
|
||||||
else if (func && !handle_editing(func)) {
|
else if (function && !handle_editing(function)) {
|
||||||
/* When it's a permissible shortcut, run it and done. */
|
/* When it's a permissible shortcut, run it and done. */
|
||||||
if (!ISSET(VIEW_MODE) || !changes_something(func)) {
|
if (!ISSET(VIEW_MODE) || !changes_something(function)) {
|
||||||
func();
|
function();
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_HISTORIES) && defined(ENABLE_TABCOMP)
|
#if defined(ENABLE_HISTORIES) && defined(ENABLE_TABCOMP)
|
||||||
previous_was_tab = (func == do_tab);
|
previous_was_tab = (function == do_tab);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,7 +557,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
|
|
||||||
*actual = input;
|
*actual = input;
|
||||||
|
|
||||||
return func;
|
return function;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ask a question on the status bar. Return 0 when text was entered,
|
/* Ask a question on the status bar. Return 0 when text was entered,
|
||||||
@ -567,7 +567,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
|
|||||||
int do_prompt(int menu, const char *provided, linestruct **history_list,
|
int do_prompt(int menu, const char *provided, linestruct **history_list,
|
||||||
void (*refresh_func)(void), const char *msg, ...)
|
void (*refresh_func)(void), const char *msg, ...)
|
||||||
{
|
{
|
||||||
functionptrtype func = NULL;
|
functionptrtype function = NULL;
|
||||||
bool listed = FALSE;
|
bool listed = FALSE;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int retval;
|
int retval;
|
||||||
@ -592,7 +592,7 @@ int do_prompt(int menu, const char *provided, linestruct **history_list,
|
|||||||
|
|
||||||
lastmessage = VACUUM;
|
lastmessage = VACUUM;
|
||||||
|
|
||||||
func = acquire_an_answer(&retval, &listed, history_list, refresh_func);
|
function = acquire_an_answer(&retval, &listed, history_list, refresh_func);
|
||||||
free(prompt);
|
free(prompt);
|
||||||
prompt = saved_prompt;
|
prompt = saved_prompt;
|
||||||
|
|
||||||
@ -603,14 +603,14 @@ int do_prompt(int menu, const char *provided, linestruct **history_list,
|
|||||||
|
|
||||||
/* If we're done with this prompt, restore the x position to what
|
/* If we're done with this prompt, restore the x position to what
|
||||||
* it was at a possible previous prompt. */
|
* it was at a possible previous prompt. */
|
||||||
if (func == do_cancel || func == do_enter)
|
if (function == do_cancel || function == do_enter)
|
||||||
typing_x = was_typing_x;
|
typing_x = was_typing_x;
|
||||||
|
|
||||||
/* If we left the prompt via Cancel or Enter, set the return value
|
/* If we left the prompt via Cancel or Enter, set the return value
|
||||||
* properly. */
|
* properly. */
|
||||||
if (func == do_cancel)
|
if (function == do_cancel)
|
||||||
retval = -1;
|
retval = -1;
|
||||||
else if (func == do_enter)
|
else if (function == do_enter)
|
||||||
retval = (*answer == '\0') ? -2 : 0;
|
retval = (*answer == '\0') ? -2 : 0;
|
||||||
|
|
||||||
if (lastmessage == VACUUM)
|
if (lastmessage == VACUUM)
|
||||||
|
|||||||
@ -319,7 +319,7 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Some functions in global.c. */
|
/* Some functions in global.c. */
|
||||||
const keystruct *first_sc_for(int menu, void (*func)(void));
|
const keystruct *first_sc_for(int menu, void (*function)(void));
|
||||||
size_t shown_entries_for(int menu);
|
size_t shown_entries_for(int menu);
|
||||||
const keystruct *get_shortcut(int *keycode);
|
const keystruct *get_shortcut(int *keycode);
|
||||||
functionptrtype func_from_key(int *keycode);
|
functionptrtype func_from_key(int *keycode);
|
||||||
|
|||||||
14
src/search.c
14
src/search.c
@ -91,7 +91,7 @@ void search_init(bool replacing, bool retain_answer)
|
|||||||
thedefault = copy_of("");
|
thedefault = copy_of("");
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
functionptrtype func;
|
functionptrtype function;
|
||||||
/* Ask the user what to search for (or replace). */
|
/* Ask the user what to search for (or replace). */
|
||||||
int response = do_prompt(
|
int response = do_prompt(
|
||||||
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
|
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
|
||||||
@ -138,23 +138,23 @@ void search_init(bool replacing, bool retain_answer)
|
|||||||
|
|
||||||
retain_answer = TRUE;
|
retain_answer = TRUE;
|
||||||
|
|
||||||
func = func_from_key(&response);
|
function = func_from_key(&response);
|
||||||
|
|
||||||
/* If we're here, one of the five toggles was pressed, or
|
/* If we're here, one of the five toggles was pressed, or
|
||||||
* a shortcut was executed. */
|
* a shortcut was executed. */
|
||||||
if (func == case_sens_void)
|
if (function == case_sens_void)
|
||||||
TOGGLE(CASE_SENSITIVE);
|
TOGGLE(CASE_SENSITIVE);
|
||||||
else if (func == backwards_void)
|
else if (function == backwards_void)
|
||||||
TOGGLE(BACKWARDS_SEARCH);
|
TOGGLE(BACKWARDS_SEARCH);
|
||||||
else if (func == regexp_void)
|
else if (function == regexp_void)
|
||||||
TOGGLE(USE_REGEXP);
|
TOGGLE(USE_REGEXP);
|
||||||
else if (func == flip_replace) {
|
else if (function == flip_replace) {
|
||||||
if (ISSET(VIEW_MODE)) {
|
if (ISSET(VIEW_MODE)) {
|
||||||
print_view_warning();
|
print_view_warning();
|
||||||
napms(600);
|
napms(600);
|
||||||
} else
|
} else
|
||||||
replacing = !replacing;
|
replacing = !replacing;
|
||||||
} else if (func == flip_goto) {
|
} else if (function == flip_goto) {
|
||||||
goto_line_and_column(openfile->current->lineno,
|
goto_line_and_column(openfile->current->lineno,
|
||||||
openfile->placewewant + 1, TRUE, TRUE);
|
openfile->placewewant + 1, TRUE, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|||||||
12
src/text.c
12
src/text.c
@ -2761,7 +2761,7 @@ void do_linter(void)
|
|||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
int kbinput;
|
int kbinput;
|
||||||
functionptrtype func;
|
functionptrtype function;
|
||||||
struct stat lintfileinfo;
|
struct stat lintfileinfo;
|
||||||
|
|
||||||
if (stat(curlint->filename, &lintfileinfo) != -1 &&
|
if (stat(curlint->filename, &lintfileinfo) != -1 &&
|
||||||
@ -2856,16 +2856,16 @@ void do_linter(void)
|
|||||||
if (kbinput == KEY_WINCH)
|
if (kbinput == KEY_WINCH)
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
func = func_from_key(&kbinput);
|
function = func_from_key(&kbinput);
|
||||||
tmplint = curlint;
|
tmplint = curlint;
|
||||||
|
|
||||||
if (func == do_cancel || func == do_enter) {
|
if (function == do_cancel || function == do_enter) {
|
||||||
wipe_statusbar();
|
wipe_statusbar();
|
||||||
break;
|
break;
|
||||||
} else if (func == do_help) {
|
} else if (function == do_help) {
|
||||||
tmplint = NULL;
|
tmplint = NULL;
|
||||||
do_help();
|
do_help();
|
||||||
} else if (func == do_page_up || func == to_prev_block) {
|
} else if (function == do_page_up || function == to_prev_block) {
|
||||||
if (curlint->prev != NULL)
|
if (curlint->prev != NULL)
|
||||||
curlint = curlint->prev;
|
curlint = curlint->prev;
|
||||||
else if (last_wait != time(NULL)) {
|
else if (last_wait != time(NULL)) {
|
||||||
@ -2875,7 +2875,7 @@ void do_linter(void)
|
|||||||
last_wait = time(NULL);
|
last_wait = time(NULL);
|
||||||
statusline(NOTICE, curlint->msg);
|
statusline(NOTICE, curlint->msg);
|
||||||
}
|
}
|
||||||
} else if (func == do_page_down || func == to_next_block) {
|
} else if (function == do_page_down || function == to_next_block) {
|
||||||
if (curlint->next != NULL)
|
if (curlint->next != NULL)
|
||||||
curlint = curlint->next;
|
curlint = curlint->next;
|
||||||
else if (last_wait != time(NULL)) {
|
else if (last_wait != time(NULL)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user