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
browser_refresh();
curs_set(0);
#else
- nano_disabled_msg();
+ say_there_is_no_help();
#endif
} else if (func == do_search) {
/* Search for a filename. */
void do_insertfile_void(void)
{
if (ISSET(RESTRICTED)) {
- nano_disabled_msg();
+ show_restricted_warning();
return;
}
do_help(&edit_refresh);
#else
if (currmenu == MMAIN)
- nano_disabled_msg();
+ say_there_is_no_help();
else
beep();
#endif /* !DISABLE_HELP */
/* 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)
{
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
RETSIGTYPE do_suspend(int signal)
{
if (ISSET(RESTRICTED)) {
- nano_disabled_msg();
+ show_restricted_warning();
return;
}
if (ISSET(RESTRICTED) && (flag == SUSPEND || flag == MULTIBUFFER ||
flag == BACKUP_FILE || flag == NO_COLOR_SYNTAX)) {
- nano_disabled_msg();
+ show_restricted_warning();
return;
}
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
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);
const char *spell_msg;
if (ISSET(RESTRICTED)) {
- nano_disabled_msg();
+ show_restricted_warning();
return;
}
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
if (ISSET(RESTRICTED)) {
- nano_disabled_msg();
- return;
+ show_restricted_warning();
+ return;
}
if (!openfile->syntax || !openfile->syntax->linter) {