readd the Cancel -> Exit aliases for the file browser and help browser,
per Benno Schulenberg's suggestion, and clean up a few other miscellaneous things git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3428 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
854a44a414
commit
bc80cb1ba7
|
@ -51,6 +51,10 @@ CVS code -
|
||||||
help_init(). (DLR, suggested by Benno Schulenberg)
|
help_init(). (DLR, suggested by Benno Schulenberg)
|
||||||
- Reduce NO_RCFILE to a static bool in nano.c, since it's only
|
- Reduce NO_RCFILE to a static bool in nano.c, since it's only
|
||||||
used there. Changes to finish() and main(). (DLR)
|
used there. Changes to finish() and main(). (DLR)
|
||||||
|
- Readd the Cancel -> Exit aliases for the file browser and help
|
||||||
|
browser. New function parse_help_input(); changes to
|
||||||
|
parse_browser_input() and do_help(). (DLR, suggested by Benno
|
||||||
|
Schulenberg)
|
||||||
- files.c:
|
- files.c:
|
||||||
open_file()
|
open_file()
|
||||||
- Remove redundant wording in the error message when we try to
|
- Remove redundant wording in the error message when we try to
|
||||||
|
@ -106,6 +110,7 @@ CVS code -
|
||||||
- Call get_shortcut() after getting input, so that we only have
|
- Call get_shortcut() after getting input, so that we only have
|
||||||
to check for a main shortcut key instead of both it and all of
|
to check for a main shortcut key instead of both it and all of
|
||||||
its equivalents. (DLR)
|
its equivalents. (DLR)
|
||||||
|
- Clean up the handling of NANO_REFRESH_KEY. (DLR)
|
||||||
help_init()
|
help_init()
|
||||||
- If we have at least two entries' worth of blank space, use it
|
- If we have at least two entries' worth of blank space, use it
|
||||||
to display more of "^Space" and "M-Space". (DLR, suggested by
|
to display more of "^Space" and "M-Space". (DLR, suggested by
|
||||||
|
@ -122,6 +127,9 @@ CVS code -
|
||||||
disabled, so that we aren't erroneously kicked out of the
|
disabled, so that we aren't erroneously kicked out of the
|
||||||
statusbar prompt under any circumstances. (DLR, found by Benno
|
statusbar prompt under any circumstances. (DLR, found by Benno
|
||||||
Schulenberg)
|
Schulenberg)
|
||||||
|
do_yesno()
|
||||||
|
- Handle the keys in a switch statement instead of a long if
|
||||||
|
block, for simplicity. (DLR)
|
||||||
- rcfile.c:
|
- rcfile.c:
|
||||||
parse_argument()
|
parse_argument()
|
||||||
- Rename variable ptr_bak to ptr_save, for consistency. (DLR)
|
- Rename variable ptr_bak to ptr_save, for consistency. (DLR)
|
||||||
|
|
|
@ -486,7 +486,7 @@ void browser_init(const char *path, DIR *dir)
|
||||||
/* Determine the shortcut key corresponding to the values of kbinput
|
/* Determine the shortcut key corresponding to the values of kbinput
|
||||||
* (the key itself), meta_key (whether the key is a meta sequence), and
|
* (the key itself), meta_key (whether the key is a meta sequence), and
|
||||||
* func_key (whether the key is a function key), if any. In the
|
* func_key (whether the key is a function key), if any. In the
|
||||||
* process, convert certain non-shortcut keys used by Pico's file
|
* process, convert certain non-shortcut keys used by e.g. Pico's file
|
||||||
* browser into their corresponding shortcut keys. */
|
* browser into their corresponding shortcut keys. */
|
||||||
void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key)
|
void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||||
{
|
{
|
||||||
|
@ -504,6 +504,8 @@ void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||||
case '?':
|
case '?':
|
||||||
*kbinput = NANO_HELP_KEY;
|
*kbinput = NANO_HELP_KEY;
|
||||||
break;
|
break;
|
||||||
|
/* Cancel is equivalent to Exit here. */
|
||||||
|
case NANO_CANCEL_KEY:
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'e':
|
case 'e':
|
||||||
*kbinput = NANO_EXIT_KEY;
|
*kbinput = NANO_EXIT_KEY;
|
||||||
|
|
33
src/help.c
33
src/help.c
|
@ -111,17 +111,16 @@ void do_help(void (*refresh_func)(void))
|
||||||
if (!no_more)
|
if (!no_more)
|
||||||
line++;
|
line++;
|
||||||
break;
|
break;
|
||||||
|
case NANO_REFRESH_KEY:
|
||||||
|
total_redraw();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kbinput == NANO_REFRESH_KEY)
|
if ((kbinput != ERR && line == old_line) || kbinput ==
|
||||||
/* Redraw the screen. */
|
NANO_REFRESH_KEY)
|
||||||
total_redraw();
|
|
||||||
else {
|
|
||||||
if (kbinput != ERR && line == old_line)
|
|
||||||
goto skip_redisplay;
|
goto skip_redisplay;
|
||||||
|
|
||||||
blank_edit();
|
blank_edit();
|
||||||
}
|
|
||||||
|
|
||||||
/* Calculate where in the text we should be, based on the
|
/* Calculate where in the text we should be, based on the
|
||||||
* page. */
|
* page. */
|
||||||
|
@ -143,7 +142,7 @@ void do_help(void (*refresh_func)(void))
|
||||||
|
|
||||||
skip_redisplay:
|
skip_redisplay:
|
||||||
kbinput = get_kbinput(edit, &meta_key, &func_key);
|
kbinput = get_kbinput(edit, &meta_key, &func_key);
|
||||||
get_shortcut(help_list, &kbinput, &meta_key, &func_key);
|
parse_help_input(&kbinput, &meta_key, &func_key);
|
||||||
} while (kbinput != NANO_EXIT_KEY);
|
} while (kbinput != NANO_EXIT_KEY);
|
||||||
|
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
|
@ -547,6 +546,26 @@ void help_init(void)
|
||||||
assert(strlen(help_text) <= allocsize + 1);
|
assert(strlen(help_text) <= allocsize + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine the shortcut key corresponding to the values of kbinput
|
||||||
|
* (the key itself), meta_key (whether the key is a meta sequence), and
|
||||||
|
* func_key (whether the key is a function key), if any. In the
|
||||||
|
* process, convert certain non-shortcut keys used by e.g. Pico's help
|
||||||
|
* browser into their corresponding shortcut keys. */
|
||||||
|
void parse_help_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||||
|
{
|
||||||
|
get_shortcut(help_list, kbinput, meta_key, func_key);
|
||||||
|
|
||||||
|
/* Pico compatibility. */
|
||||||
|
if (*meta_key == FALSE && *func_key == FALSE) {
|
||||||
|
switch (*kbinput) {
|
||||||
|
/* Cancel is equivalent to Exit here. */
|
||||||
|
case NANO_CANCEL_KEY:
|
||||||
|
*kbinput = NANO_EXIT_KEY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Calculate the next line of help_text, starting at ptr. */
|
/* Calculate the next line of help_text, starting at ptr. */
|
||||||
size_t help_line_len(const char *ptr)
|
size_t help_line_len(const char *ptr)
|
||||||
{
|
{
|
||||||
|
|
28
src/prompt.c
28
src/prompt.c
|
@ -1268,13 +1268,12 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||||
|
|
||||||
kbinput = get_kbinput(bottomwin, &meta_key, &func_key);
|
kbinput = get_kbinput(bottomwin, &meta_key, &func_key);
|
||||||
|
|
||||||
if (kbinput == NANO_REFRESH_KEY) {
|
switch (kbinput) {
|
||||||
total_redraw();
|
case NANO_CANCEL_KEY:
|
||||||
continue;
|
|
||||||
} else if (kbinput == NANO_CANCEL_KEY)
|
|
||||||
ok = -1;
|
ok = -1;
|
||||||
|
break;
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
else if (kbinput == KEY_MOUSE) {
|
case KEY_MOUSE:
|
||||||
get_mouseinput(&mouse_x, &mouse_y, FALSE);
|
get_mouseinput(&mouse_x, &mouse_y, FALSE);
|
||||||
|
|
||||||
if (mouse_x != -1 && mouse_y != -1 && !ISSET(NO_HELP) &&
|
if (mouse_x != -1 && mouse_y != -1 && !ISSET(NO_HELP) &&
|
||||||
|
@ -1295,23 +1294,28 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||||
|
|
||||||
assert(0 <= x && x <= 1 && 0 <= y && y <= 1);
|
assert(0 <= x && x <= 1 && 0 <= y && y <= 1);
|
||||||
|
|
||||||
/* x == 0 means they clicked Yes or No. y == 0 means
|
/* x == 0 means they clicked Yes or No. y == 0
|
||||||
* Yes or All. */
|
* means Yes or All. */
|
||||||
ok = -2 * x * y + x - y + 1;
|
ok = -2 * x * y + x - y + 1;
|
||||||
|
|
||||||
if (ok == 2 && !all)
|
if (ok == 2 && !all)
|
||||||
ok = -2;
|
ok = -2;
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
#endif
|
#endif /* !DISABLE_MOUSE */
|
||||||
/* Look for the kbinput in the Yes, No and (optionally) All
|
case NANO_REFRESH_KEY:
|
||||||
* strings. */
|
total_redraw();
|
||||||
else if (strchr(yesstr, kbinput) != NULL)
|
continue;
|
||||||
|
default:
|
||||||
|
/* Look for the kbinput in the Yes, No and (optionally)
|
||||||
|
* All strings. */
|
||||||
|
if (strchr(yesstr, kbinput) != NULL)
|
||||||
ok = 1;
|
ok = 1;
|
||||||
else if (strchr(nostr, kbinput) != NULL)
|
else if (strchr(nostr, kbinput) != NULL)
|
||||||
ok = 0;
|
ok = 0;
|
||||||
else if (all && strchr(allstr, kbinput) != NULL)
|
else if (all && strchr(allstr, kbinput) != NULL)
|
||||||
ok = 2;
|
ok = 2;
|
||||||
|
}
|
||||||
} while (ok == -2);
|
} while (ok == -2);
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
|
|
@ -351,6 +351,7 @@ void do_help_void(void);
|
||||||
void do_browser_help(void);
|
void do_browser_help(void);
|
||||||
#endif
|
#endif
|
||||||
void help_init(void);
|
void help_init(void);
|
||||||
|
void parse_help_input(int *kbinput, bool *meta_key, bool *func_key);
|
||||||
size_t help_line_len(const char *ptr);
|
size_t help_line_len(const char *ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue