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-d3aeb78583b8master
parent
104ea6b0c3
commit
6847616aee
|
@ -1,7 +1,11 @@
|
||||||
2015-07-30 Benno Schulenberg <bensberg@justemail.net>
|
2015-07-30 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/global.c (shortcut_init): Don't show ^R and ^T in the help lines
|
* src/global.c (shortcut_init): Don't show ^R and ^T in the help
|
||||||
in restricted mode (if possible), to give visual feedback.
|
lines in restricted mode (if possible), to give visual feedback.
|
||||||
* src/*.c: Normalize the whitespace after the preceding changes.
|
* 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>
|
2015-07-29 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/text.c (do_linter): When the linter is called in restricted mode
|
* src/text.c (do_linter): When the linter is called in restricted mode
|
||||||
|
|
|
@ -174,7 +174,7 @@ char *do_browser(char *path, DIR *dir)
|
||||||
browser_refresh();
|
browser_refresh();
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
#else
|
#else
|
||||||
nano_disabled_msg();
|
say_there_is_no_help();
|
||||||
#endif
|
#endif
|
||||||
} else if (func == do_search) {
|
} else if (func == do_search) {
|
||||||
/* Search for a filename. */
|
/* Search for a filename. */
|
||||||
|
|
|
@ -1295,7 +1295,7 @@ void do_insertfile(
|
||||||
void do_insertfile_void(void)
|
void do_insertfile_void(void)
|
||||||
{
|
{
|
||||||
if (ISSET(RESTRICTED)) {
|
if (ISSET(RESTRICTED)) {
|
||||||
nano_disabled_msg();
|
show_restricted_warning();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -533,7 +533,7 @@ void do_help_void(void)
|
||||||
do_help(&edit_refresh);
|
do_help(&edit_refresh);
|
||||||
#else
|
#else
|
||||||
if (currmenu == MMAIN)
|
if (currmenu == MMAIN)
|
||||||
nano_disabled_msg();
|
say_there_is_no_help();
|
||||||
else
|
else
|
||||||
beep();
|
beep();
|
||||||
#endif /* !DISABLE_HELP */
|
#endif /* !DISABLE_HELP */
|
||||||
|
|
27
src/nano.c
27
src/nano.c
|
@ -593,9 +593,24 @@ void free_openfilestruct(openfilestruct *src)
|
||||||
/* Display a warning about a key disabled in view mode. */
|
/* Display a warning about a key disabled in view mode. */
|
||||||
void print_view_warning(void)
|
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. */
|
/* Make nano exit gracefully. */
|
||||||
void finish(void)
|
void finish(void)
|
||||||
{
|
{
|
||||||
|
@ -1086,12 +1101,6 @@ int no_help(void)
|
||||||
return ISSET(NO_HELP) ? 2 : 0;
|
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
|
/* 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
|
* 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
|
* 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)
|
RETSIGTYPE do_suspend(int signal)
|
||||||
{
|
{
|
||||||
if (ISSET(RESTRICTED)) {
|
if (ISSET(RESTRICTED)) {
|
||||||
nano_disabled_msg();
|
show_restricted_warning();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1429,7 +1438,7 @@ void do_toggle(int flag)
|
||||||
|
|
||||||
if (ISSET(RESTRICTED) && (flag == SUSPEND || flag == MULTIBUFFER ||
|
if (ISSET(RESTRICTED) && (flag == SUSPEND || flag == MULTIBUFFER ||
|
||||||
flag == BACKUP_FILE || flag == NO_COLOR_SYNTAX)) {
|
flag == BACKUP_FILE || flag == NO_COLOR_SYNTAX)) {
|
||||||
nano_disabled_msg();
|
show_restricted_warning();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -450,6 +450,10 @@ void delete_opennode(openfilestruct *fileptr);
|
||||||
void free_openfilestruct(openfilestruct *src);
|
void free_openfilestruct(openfilestruct *src);
|
||||||
#endif
|
#endif
|
||||||
void print_view_warning(void);
|
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 finish(void);
|
||||||
void die(const char *msg, ...);
|
void die(const char *msg, ...);
|
||||||
void die_save_file(const char *die_filename
|
void die_save_file(const char *die_filename
|
||||||
|
@ -472,7 +476,6 @@ void usage(void);
|
||||||
void version(void);
|
void version(void);
|
||||||
int more_space(void);
|
int more_space(void);
|
||||||
int no_help(void);
|
int no_help(void);
|
||||||
void nano_disabled_msg(void);
|
|
||||||
void do_exit(void);
|
void do_exit(void);
|
||||||
void signal_init(void);
|
void signal_init(void);
|
||||||
RETSIGTYPE handle_hupterm(int signal);
|
RETSIGTYPE handle_hupterm(int signal);
|
||||||
|
|
|
@ -2831,7 +2831,7 @@ void do_spell(void)
|
||||||
const char *spell_msg;
|
const char *spell_msg;
|
||||||
|
|
||||||
if (ISSET(RESTRICTED)) {
|
if (ISSET(RESTRICTED)) {
|
||||||
nano_disabled_msg();
|
show_restricted_warning();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2904,8 +2904,8 @@ void do_linter(void)
|
||||||
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
|
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
|
||||||
|
|
||||||
if (ISSET(RESTRICTED)) {
|
if (ISSET(RESTRICTED)) {
|
||||||
nano_disabled_msg();
|
show_restricted_warning();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!openfile->syntax || !openfile->syntax->linter) {
|
if (!openfile->syntax || !openfile->syntax->linter) {
|
||||||
|
|
Loading…
Reference in New Issue