Differentiating between something being disabled/restricted and

help texts being unavailable.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5331 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-07-30 18:10:16 +00:00
parent 104ea6b0c3
commit 6847616aee
7 changed files with 34 additions and 18 deletions

View File

@ -1,7 +1,11 @@
2015-07-30 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init): Don't show ^R and ^T in the help lines
in restricted mode (if possible), to give visual feedback.
* src/global.c (shortcut_init): Don't show ^R and ^T in the help
lines in restricted mode (if possible), to give visual feedback.
* src/*.c: Normalize the whitespace after the preceding changes.
* src/nano.c (show_restricted_warning, say_there_is_no_help):
Differentiate between something being disabled/restricted (because
of the way of invocation) and help texts being unavailable (which
is a compile-time decision).
2015-07-29 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_linter): When the linter is called in restricted mode

View File

@ -174,7 +174,7 @@ char *do_browser(char *path, DIR *dir)
browser_refresh();
curs_set(0);
#else
nano_disabled_msg();
say_there_is_no_help();
#endif
} else if (func == do_search) {
/* Search for a filename. */

View File

@ -1295,7 +1295,7 @@ void do_insertfile(
void do_insertfile_void(void)
{
if (ISSET(RESTRICTED)) {
nano_disabled_msg();
show_restricted_warning();
return;
}

View File

@ -533,7 +533,7 @@ void do_help_void(void)
do_help(&edit_refresh);
#else
if (currmenu == MMAIN)
nano_disabled_msg();
say_there_is_no_help();
else
beep();
#endif /* !DISABLE_HELP */

View File

@ -593,9 +593,24 @@ void free_openfilestruct(openfilestruct *src)
/* Display a warning about a key disabled in view mode. */
void print_view_warning(void)
{
statusbar(_("Key invalid in view mode"));
statusbar(_("Key is invalid in view mode"));
}
/* Indicate that something is disabled in restricted mode. */
void show_restricted_warning(void)
{
statusbar(_("This function is disabled in restricted mode"));
beep();
}
#ifdef DISABLE_HELP
/* Indicate that help texts are unavailable. */
void say_there_is_no_help(void)
{
statusbar(_("Help is unavailable"));
}
#endif
/* Make nano exit gracefully. */
void finish(void)
{
@ -1086,12 +1101,6 @@ int no_help(void)
return ISSET(NO_HELP) ? 2 : 0;
}
/* Indicate a disabled function on the statusbar. */
void nano_disabled_msg(void)
{
statusbar(_("Sorry, support for this function has been disabled"));
}
/* If the current file buffer has been modified, and the TEMP_FILE flag
* isn't set, ask whether or not to save the file buffer. If the
* TEMP_FILE flag is set and the current file has a name, save it
@ -1280,7 +1289,7 @@ RETSIGTYPE handle_hupterm(int signal)
RETSIGTYPE do_suspend(int signal)
{
if (ISSET(RESTRICTED)) {
nano_disabled_msg();
show_restricted_warning();
return;
}
@ -1429,7 +1438,7 @@ void do_toggle(int flag)
if (ISSET(RESTRICTED) && (flag == SUSPEND || flag == MULTIBUFFER ||
flag == BACKUP_FILE || flag == NO_COLOR_SYNTAX)) {
nano_disabled_msg();
show_restricted_warning();
return;
}

View File

@ -450,6 +450,10 @@ void delete_opennode(openfilestruct *fileptr);
void free_openfilestruct(openfilestruct *src);
#endif
void print_view_warning(void);
void show_restricted_warning(void);
#ifdef DISABLE_HELP
void say_there_is_no_help(void);
#endif
void finish(void);
void die(const char *msg, ...);
void die_save_file(const char *die_filename
@ -472,7 +476,6 @@ void usage(void);
void version(void);
int more_space(void);
int no_help(void);
void nano_disabled_msg(void);
void do_exit(void);
void signal_init(void);
RETSIGTYPE handle_hupterm(int signal);

View File

@ -2831,7 +2831,7 @@ void do_spell(void)
const char *spell_msg;
if (ISSET(RESTRICTED)) {
nano_disabled_msg();
show_restricted_warning();
return;
}
@ -2904,8 +2904,8 @@ void do_linter(void)
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
if (ISSET(RESTRICTED)) {
nano_disabled_msg();
return;
show_restricted_warning();
return;
}
if (!openfile->syntax || !openfile->syntax->linter) {