Deleting old wrapper 'getfuncfromkey()', and replacing its call
with a call of the new wrapper 'func_from_key()'. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5052 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
6418ffa289
commit
6c86ee1a5b
|
@ -5,6 +5,10 @@
|
|||
wrapper to make the code a bit cleaner.
|
||||
* src/help.c (do_help, parse_help_input): Use the wrapper.
|
||||
* src/browser.c (do_browser, parse_browser_input): Likewise.
|
||||
* src/search.c (search_init, do_gotolinecolumn): Likewise.
|
||||
* src/search.c (findnextstr): Replace a call of old wrapper
|
||||
'getfuncfromkey()' with a call of new 'func_from_key()'.
|
||||
* src/winio.c (getfuncfromkey): Delete now unneeded wrapper.
|
||||
|
||||
2014-07-01 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (do_browser), src/help.c (do_help): Make sure
|
||||
|
|
|
@ -363,7 +363,6 @@ void set_lint_shortcuts(void);
|
|||
void set_spell_shortcuts(void);
|
||||
#endif
|
||||
const subnfunc *sctofunc(sc *s);
|
||||
const subnfunc *getfuncfromkey(WINDOW *win);
|
||||
const char *flagtostr(int flag);
|
||||
sc *strtosc(char *input);
|
||||
int strtomenu(char *input);
|
||||
|
|
23
src/search.c
23
src/search.c
|
@ -137,7 +137,6 @@ int search_init(bool replacing, bool use_answer)
|
|||
{
|
||||
int i = 0;
|
||||
char *buf;
|
||||
sc *s;
|
||||
static char *backupstring = NULL;
|
||||
/* The search string we'll be using. */
|
||||
|
||||
|
@ -214,13 +213,7 @@ int search_init(bool replacing, bool use_answer)
|
|||
statusbar(_("Cancelled"));
|
||||
return -1;
|
||||
} else {
|
||||
void (*func)(void) = NULL;
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if ((s->menu & currmenu) && i == s->seq) {
|
||||
func = s->scfunc;
|
||||
break;
|
||||
}
|
||||
functionptrtype func = func_from_key(&i);
|
||||
|
||||
if (i == -2 || i == 0 ) {
|
||||
#ifdef HAVE_REGEX_H
|
||||
|
@ -284,7 +277,6 @@ bool findnextstr(
|
|||
ssize_t current_y_find = openfile->current_y;
|
||||
filestruct *fileptr = openfile->current;
|
||||
const char *rev_start = fileptr->data, *found = NULL;
|
||||
const subnfunc *f;
|
||||
time_t lastkbcheck = time(NULL);
|
||||
|
||||
/* rev_start might end up 1 character before the start or after the
|
||||
|
@ -303,9 +295,11 @@ bool findnextstr(
|
|||
enable_nodelay();
|
||||
while (TRUE) {
|
||||
if (time(NULL) - lastkbcheck > 1) {
|
||||
int input = parse_kbinput(edit);
|
||||
|
||||
lastkbcheck = time(NULL);
|
||||
f = getfuncfromkey(edit);
|
||||
if (f && f->scfunc == do_cancel) {
|
||||
|
||||
if (input && func_from_key(&input) == do_cancel) {
|
||||
statusbar(_("Cancelled"));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1023,10 +1017,9 @@ void goto_line_posx(ssize_t line, size_t pos_x)
|
|||
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive, bool save_pos, bool allow_update)
|
||||
{
|
||||
const sc *s;
|
||||
|
||||
if (interactive) {
|
||||
char *ans = mallocstrcpy(NULL, answer);
|
||||
functionptrtype func;
|
||||
|
||||
/* Ask for the line and column. */
|
||||
int i = do_prompt(FALSE,
|
||||
|
@ -1049,9 +1042,9 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
|||
return;
|
||||
}
|
||||
|
||||
s = get_shortcut(&i);
|
||||
func = func_from_key(&i);
|
||||
|
||||
if (s && s->scfunc == gototext_void) {
|
||||
if (func == gototext_void) {
|
||||
/* Keep answer up on the statusbar. */
|
||||
search_init(TRUE, TRUE);
|
||||
|
||||
|
|
17
src/winio.c
17
src/winio.c
|
@ -1815,23 +1815,6 @@ const sc *get_shortcut(int *kbinput)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* Try to get a function back from a window. Just a wrapper. */
|
||||
const subnfunc *getfuncfromkey(WINDOW *win)
|
||||
{
|
||||
int kbinput;
|
||||
const sc *s;
|
||||
|
||||
kbinput = parse_kbinput(win);
|
||||
if (kbinput == 0)
|
||||
return NULL;
|
||||
|
||||
s = get_shortcut(&kbinput);
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
return sctofunc((sc *) s);
|
||||
}
|
||||
|
||||
/* Move to (x, y) in win, and display a line of n spaces with the
|
||||
* current attributes. */
|
||||
void blank_line(WINDOW *win, int y, int x, int n)
|
||||
|
|
Loading…
Reference in New Issue