From e29111f7ec9f26a3143150a2d8c7dd614e3ffe14 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 17 Jun 2005 19:06:25 +0000 Subject: [PATCH] add -U/--quickblank option, a Meta-U toggle, and a "quickblank" rcfile option to blank the statusbar after 1 keystroke instead of 25; note that this is disabled when NANO_SMALL is defined git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2709 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 6 ++++++ doc/man/nano.1 | 6 +++++- doc/man/nanorc.5 | 4 ++++ doc/nanorc.sample | 9 +++++++-- src/global.c | 2 ++ src/nano.c | 12 ++++++++++-- src/nano.h | 4 +++- src/rcfile.c | 1 + src/winio.c | 6 +++++- 9 files changed, 43 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36ff3639..d3c2e00a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -105,6 +105,12 @@ CVS code - - Since the DISABLE_CURPOS flag is only used in winio.c, reduce it to a static bool there. Changes to statusbar() and disable_cursorpos(). (DLR) + - Add -U/--quickblank option, a Meta-U toggle, and a + "quickblank" rcfile option to blank the statusbar after 1 + keystroke instead of 25. Note that this is disabled when + NANO_SMALL is defined. Changes to toggle_init(), usage(), + main(), statusbar(), nanorc.sample, nano.1, and nanorc.5. + (DLR, suggested by CHAO Wei-Lun) - chars.c: make_mbstring() - Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a diff --git a/doc/man/nano.1 b/doc/man/nano.1 index 9a50b49f..240f2316 100644 --- a/doc/man/nano.1 +++ b/doc/man/nano.1 @@ -6,7 +6,7 @@ .\" Public License for copying conditions. There is NO warranty. .\" .\" $Id$ -.TH NANO 1 "version 1.3.8" "June 16, 2005" +.TH NANO 1 "version 1.3.8" "June 17, 2005" .\" Please adjust this date whenever revising the manpage. .\" @@ -91,6 +91,10 @@ usual chunk-by-chunk behavior. .B \-T \fIcols\fP (\-\-tabsize=\fIcols\fP) Set the size (width) of a tab to \fIcols\fP columns. .TP +.B \-U (\-\-quickblank) +Do quick statusbar blanking. Statusbar messages will disappear after 1 +keystroke instead of 25. +.TP .B \-V (\-\-version) Show the current version number and author. .TP diff --git a/doc/man/nanorc.5 b/doc/man/nanorc.5 index 6b306c19..6f20acff 100644 --- a/doc/man/nanorc.5 +++ b/doc/man/nanorc.5 @@ -114,6 +114,10 @@ Set the characters treated as closing punctuation. They cannot contain blank characters. Only closing punctuation, optionally followed by closing brackets, can end sentences. .TP +.B set quickblank +Do quick statusbar blanking. Statusbar messages will disappear after 1 +keystroke instead of 25. +.TP .B set quotestr "\fIstring\fP" The email-quote string, used to justify email-quoted paragraphs. This is an "extended regular expression" if your system supports them, diff --git a/doc/nanorc.sample b/doc/nanorc.sample index 285edca3..92fd9738 100644 --- a/doc/nanorc.sample +++ b/doc/nanorc.sample @@ -85,6 +85,11 @@ ## # set punct ".?!" +## Do quick statusbar blanking. Statusbar messages will disappear after +## 1 keystroke instead of 25. +## +# set quickblank + ## The email-quote string, used to justify email-quoted paragraphs. ## This is an extended regular expression if your system supports them, ## otherwise a literal string. Default: @@ -273,8 +278,8 @@ ## highlight possible errors and parameters # color brightwhite "^ *(set|unset|syntax|color).*$" ## set, unset and syntax -# color cyan "^ *(set|unset) +(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quotestr|rebinddelete|regexp|smarthome|smooth|speller)\>" -# color cyan "^ *(set|unset) +(suspend|tabsize|tabstospaces|tempfile|view|whitespace)" +# color cyan "^ *(set|unset) +(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quickblank|quotestr|rebinddelete|regexp|smarthome|smooth)\>" +# color cyan "^ *(set|unset) +(speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace)" # color green "^ *(set|unset|syntax)\>" ## colors # color yellow "^ *color *(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>" diff --git a/src/global.c b/src/global.c index ce6dd575..af715e4d 100644 --- a/src/global.c +++ b/src/global.c @@ -1153,6 +1153,8 @@ void toggle_init(void) N_("Use of more space for editing"), MORE_SPACE); toggle_init_one(TOGGLE_TABSTOSPACES_KEY, N_("Conversion of typed tabs to spaces"), TABS_TO_SPACES); + toggle_init_one(TOGGLE_QUICKBLANK_KEY, + N_("Quick statusbar blanking"), QUICK_BLANK); } #endif /* !NANO_SMALL */ diff --git a/src/nano.c b/src/nano.c index c76a9347..a048028f 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1056,6 +1056,8 @@ void usage(void) #endif print1opt(_("-T [#cols]"), _("--tabsize=[#cols]"), N_("Set width of a tab in cols to #cols")); + print1opt("-U", _("--quickblank"), + N_("Do quick statusbar blanking")); print1opt("-V", "--version", N_("Print version information and exit")); #ifdef ENABLE_COLOR @@ -4151,6 +4153,7 @@ int main(int argc, char **argv) {"historylog", 0, NULL, 'H'}, {"noconvert", 0, NULL, 'N'}, {"smooth", 0, NULL, 'S'}, + {"quickblank", 0, NULL, 'U'}, {"restricted", 0, NULL, 'Z'}, {"autoindent", 0, NULL, 'i'}, {"cut", 0, NULL, 'k'}, @@ -4192,11 +4195,11 @@ int main(int argc, char **argv) while ((optchr = #ifdef HAVE_GETOPT_LONG getopt_long(argc, argv, - "h?ABC:EFHINOQ:ST:VY:Zabcdefgijklmo:pr:s:tvwxz", + "h?ABC:EFHINOQ:ST:UVY:Zabcdefgijklmo:pr:s:tvwxz", long_options, NULL) #else getopt(argc, argv, - "h?ABC:EFHINOQ:ST:VY:Zabcdefgijklmo:pr:s:tvwxz") + "h?ABC:EFHINOQ:ST:UVY:Zabcdefgijklmo:pr:s:tvwxz") #endif ) != -1) { @@ -4263,6 +4266,11 @@ int main(int argc, char **argv) exit(1); } break; +#ifndef NANO_SMALL + case 'U': + SET(QUICK_BLANK); + break; +#endif case 'V': version(); exit(0); diff --git a/src/nano.h b/src/nano.h index 013b6e0f..5cdfe6a5 100644 --- a/src/nano.h +++ b/src/nano.h @@ -303,7 +303,8 @@ typedef struct syntaxtype { #define WHITESPACE_DISPLAY (1<<26) #define MORE_SPACE (1<<27) #define TABS_TO_SPACES (1<<28) -#define USE_UTF8 (1<<29) +#define QUICK_BLANK (1<<29) +#define USE_UTF8 (1<<30) /* Control key sequences. Changing these would be very, very bad. */ #define NANO_CONTROL_SPACE 0 @@ -490,6 +491,7 @@ typedef struct syntaxtype { #define TOGGLE_WHITESPACE_KEY NANO_ALT_P #define TOGGLE_MORESPACE_KEY NANO_ALT_O #define TOGGLE_TABSTOSPACES_KEY NANO_ALT_E +#define TOGGLE_QUICKBLANK_KEY NANO_ALT_U #endif /* !NANO_SMALL */ #define MAIN_VISIBLE 12 diff --git a/src/rcfile.c b/src/rcfile.c index b76f6ad5..7bf5d254 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -84,6 +84,7 @@ const static rcoption rcopts[] = { {"cut", CUT_TO_END}, {"historylog", HISTORYLOG}, {"noconvert", NO_CONVERT}, + {"quickblank", QUICK_BLANK}, {"smarthome", SMART_HOME}, {"smooth", SMOOTH_SCROLL}, {"tabstospaces", TABS_TO_SPACES}, diff --git a/src/winio.c b/src/winio.c index 58bed7a1..60c9a485 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2893,7 +2893,11 @@ void statusbar(const char *msg, ...) } disable_cursorpos = TRUE; - statusblank = 25; + statusblank = +#ifndef NANO_SMALL + ISSET(QUICK_BLANK) ? 1 : +#endif + 25; } void bottombars(const shortcut *s) -- 2.39.5