From 2ee18d635f6900a3ef6a77d4b830e7e7c8e7498d Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 30 Jul 2015 10:37:28 +0000 Subject: [PATCH] Not showing ^R and ^T in the help lines in restricted mode (if possible), to give visual feedback. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5329 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/global.c | 22 +++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 190d82d5..a0e566bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-07-30 Benno Schulenberg + * src/global.c (shortcut_init): Don't show ^R and ^T in the help lines + in restricted mode (if possible), to give visual feedback. + 2015-07-29 Benno Schulenberg * src/text.c (do_linter): When the linter is called in restricted mode (possible when nano was built with --disable-speller), it is better to diff --git a/src/global.c b/src/global.c index 4b2319d9..07170c45 100644 --- a/src/global.c +++ b/src/global.c @@ -685,18 +685,28 @@ void shortcut_init(void) add_to_funcs(do_writeout_void, MMAIN, N_("Write Out"), IFSCHELP(nano_writeout_msg), TOGETHER, NOVIEW); - /* We allow inserting files in view mode if multibuffers are - * available, so that we can view multiple files. If we're using - * restricted mode, inserting files is disabled, since it allows - * reading from or writing to files not specified on the command - * line. */ +#ifndef DISABLE_JUSTIFY + if (!ISSET(RESTRICTED)) { +#else + /* If we can't replace Insert with Justify, show Insert anyway, to + * keep the help items nicely paired also in restricted mode. */ + if (TRUE) { +#endif add_to_funcs(do_insertfile_void, MMAIN, read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER, + /* We allow inserting files in view mode if multibuffer mode + * is switched on, so that we can view multiple files. */ #ifndef DISABLE_MULTIBUFFER VIEW); #else NOVIEW); #endif + } else { +#ifndef DISABLE_JUSTIFY + add_to_funcs(do_justify_void, MMAIN, + N_("Justify"), IFSCHELP(nano_justify_msg), BLANKAFTER, NOVIEW); +#endif + } add_to_funcs(do_search, MMAIN, whereis_tag, IFSCHELP(nano_whereis_msg), TOGETHER, VIEW); @@ -731,6 +741,7 @@ void shortcut_init(void) /* Remember the entry for Uncut, to be able to replace it with Unjustify. */ uncutfunc = tailfunc; +if (!ISSET(RESTRICTED)) { #ifndef DISABLE_JUSTIFY add_to_funcs(do_justify_void, MMAIN, N_("Justify"), IFSCHELP(nano_justify_msg), TOGETHER, NOVIEW); @@ -749,6 +760,7 @@ void shortcut_init(void) N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW); #endif #endif +} #ifndef NANO_TINY add_to_funcs(case_sens_void, MWHEREIS|MREPLACE, -- 2.39.5