From c10d8ffe9fbe4d574e0717483a6cd0eb07f475a1 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 3 Jun 2005 20:51:39 +0000 Subject: [PATCH] for consistency, remove -R/--regexp command line option, and allow the toggle unconditionally git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2588 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 8 ++++++++ doc/man/nano.1 | 6 +----- doc/man/nanorc.5 | 5 +---- doc/nanorc.sample | 3 --- doc/texinfo/nano.texi | 5 +---- src/global.c | 22 ++++++++++++++-------- src/nano.c | 15 ++------------- src/nano.h | 2 +- src/rcfile.c | 3 --- src/search.c | 6 ++---- 10 files changed, 30 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7c62fe8..d70544a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,6 +46,14 @@ CVS code - Changes to safe_tempnam() (renamed safe_tempfile()), write_file(), write_marked(), die(), do_spell(), and do_exit(). (DLR) + - Remove the -R/--regexp command line option and enable the + toggle at the search promptin tiny mode, as it already + allows the prepend and append toggles at the search prompt. + For consistency, rename TOGGLE_REGEXP_KEY to NANO_REGEXP_KEY, + and move it out of the toggles block to where NANO_PREPEND_KEY + and NANO_APPEND_KEY are. Changes to shortcut_init(), usage(), + main(), search_init(), nanorc.sample, nano.1, nanorc.5, + nano.texi, etc. (DLR) - cut.c: cut_line() - Set placewewant properly after cutting a line, to avoid a diff --git a/doc/man/nano.1 b/doc/man/nano.1 index c1cb6679..7e808f38 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" "May 29, 2005" +.TH NANO 1 "version 1.3.8" "June 3, 2005" .\" Please adjust this date whenever revising the manpage. .\" @@ -81,10 +81,6 @@ Set the quoting string for justifying. The default is "^([\ \\t]*[|>:}#])+" if regular expression support is available, or ">\ " otherwise. .TP -.B \-R (\-\-regexp) -Enable regular expression matching for search strings, as well as -\\n subexpression replacement for replace strings, if available. -.TP .B \-S (\-\-smooth) Enable smooth scrolling. Text will scroll line-by-line, instead of the usual chunk-by-chunk behavior. diff --git a/doc/man/nanorc.5 b/doc/man/nanorc.5 index 0b1e9e12..3f537c06 100644 --- a/doc/man/nanorc.5 +++ b/doc/man/nanorc.5 @@ -6,7 +6,7 @@ .\" Public License for copying conditions. There is NO warranty. .\" .\" $Id$ -.TH NANORC 5 "version 1.3.8" "May 29, 2005" +.TH NANORC 5 "version 1.3.8" "June 3, 2005" .\" Please adjust this date whenever revising the manpage. .\" .SH NAME @@ -122,9 +122,6 @@ Interpret the Delete key differently so that both Backspace and Delete work properly. You should only need to use this option if Backspace acts like Delete on your system. .TP -\fBset/unset regexp\fP -Do regular expression searches by default. -.TP \fBset/unset smarthome\fP Make the Home key smarter. When Home is pressed anywhere but at the very beginning of non-whitespace characters on a line, the cursor will diff --git a/doc/nanorc.sample b/doc/nanorc.sample index 632f296f..d1596b39 100644 --- a/doc/nanorc.sample +++ b/doc/nanorc.sample @@ -91,9 +91,6 @@ ## Fix Backspace/Delete confusion problem. # set rebinddelete -## Do extended regular expression searches by default. -# set regexp - ## Make the Home key smarter. When Home is pressed anywhere but at the ## very beginning of non-whitespace characters on a line, the cursor ## will jump to that beginning (either forwards or backwards). If the diff --git a/doc/texinfo/nano.texi b/doc/texinfo/nano.texi index b119a945..c552a5c8 100644 --- a/doc/texinfo/nano.texi +++ b/doc/texinfo/nano.texi @@ -9,7 +9,7 @@ @smallbook @set EDITION 0.1 @set VERSION 1.3.8 -@set UPDATED 29 May 2005 +@set UPDATED 03 Jun 2005 @dircategory Editors @direntry @@ -148,9 +148,6 @@ Set the quoting string for justifying. The default is if regular expression support is available, or ``> '' otherwise. Note that @code{\t} above stands for a literal Tab character. -@item -R, --regexp -Turn on regular expression search and search/replace. - @item -S, --smooth Enable smooth scrolling. diff --git a/src/global.c b/src/global.c index b0eea24f..d25e4a32 100644 --- a/src/global.c +++ b/src/global.c @@ -253,18 +253,19 @@ void shortcut_init(bool unjustify) #ifndef NANO_SMALL const char *case_sens_msg = N_("Case Sens"); const char *direction_msg = N_("Direction"); +#endif #ifdef HAVE_REGEX_H const char *regexp_msg = N_("Regexp"); #endif +#ifndef NANO_SMALL const char *history_msg = N_("History"); #ifdef ENABLE_MULTIBUFFER const char *new_buffer_msg = N_("New Buffer"); #endif -#endif /* !NANO_SMALL */ +#endif #ifndef DISABLE_BROWSER const char *to_files_msg = N_("To Files"); #endif - #ifndef DISABLE_HELP const char *nano_help_msg = N_("Invoke the help menu"); const char *nano_exit_msg = @@ -341,13 +342,14 @@ void shortcut_init(bool unjustify) N_("Make the current search/replace case (in)sensitive"); const char *nano_reverse_msg = N_("Make the current search/replace go backwards"); +#endif #ifdef HAVE_REGEX_H const char *nano_regexp_msg = N_("Use regular expressions"); #endif +#ifndef NANO_SMALL const char *nano_history_msg = N_("Edit the previous search/replace strings"); -#endif /* !NANO_SMALL */ - +#endif #ifndef DISABLE_BROWSER const char *nano_tofiles_msg = N_("Go to file browser"); #endif @@ -660,14 +662,16 @@ void shortcut_init(bool unjustify) sc_init_one(&whereis_list, NANO_NO_KEY, direction_msg, IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL); +#endif #ifdef HAVE_REGEX_H /* Translators: try to keep this string under 10 characters long */ sc_init_one(&whereis_list, NANO_NO_KEY, regexp_msg, - IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY, + IFHELP(nano_regexp_msg, NANO_REGEXP_KEY), NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL); #endif +#ifndef NANO_SMALL /* Translators: try to keep this string under 10 characters long */ sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg, IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY, @@ -677,7 +681,7 @@ void shortcut_init(bool unjustify) sc_init_one(&whereis_list, NANO_CUTTILLEND_KEY, cut_till_end_msg, IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end); -#endif /* !NANO_SMALL */ +#endif #ifndef DISABLE_JUSTIFY /* Translators: try to keep this string under 10 characters long */ @@ -727,17 +731,19 @@ void shortcut_init(bool unjustify) sc_init_one(&replace_list, NANO_NO_KEY, direction_msg, IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL); +#endif #ifdef HAVE_REGEX_H sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg, - IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY, + IFHELP(nano_regexp_msg, NANO_REGEXP_KEY), NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL); #endif +#ifndef NANO_SMALL sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg, IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL); -#endif /* !NANO_SMALL */ +#endif free_shortcutage(&replace_list_2); diff --git a/src/nano.c b/src/nano.c index d10f0031..0d165826 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1042,9 +1042,6 @@ void usage(void) print1opt(_("-Q [str]"), _("--quotestr=[str]"), N_("Quoting string, default \"> \"")); #endif -#ifdef HAVE_REGEX_H - print1opt("-R", "--regexp", N_("Do regular expression searches")); -#endif #ifndef NANO_SMALL print1opt("-S", "--smooth", N_("Smooth scrolling")); #endif @@ -4013,9 +4010,6 @@ int main(int argc, char **argv) {"morespace", 0, NULL, 'O'}, #ifndef DISABLE_JUSTIFY {"quotestr", 1, NULL, 'Q'}, -#endif -#ifdef HAVE_REGEX_H - {"regexp", 0, NULL, 'R'}, #endif {"tabsize", 1, NULL, 'T'}, {"version", 0, NULL, 'V'}, @@ -4094,9 +4088,9 @@ int main(int argc, char **argv) while ((optchr = #ifdef HAVE_GETOPT_LONG - getopt_long(argc, argv, "h?ABE:FHINOQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz", long_options, NULL) + getopt_long(argc, argv, "h?ABE:FHINOQ:ST:VY:Zabcdefgijklmo:pr:s:tvwxz", long_options, NULL) #else - getopt(argc, argv, "h?ABE:FHINOQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz") + getopt(argc, argv, "h?ABE:FHINOQ:ST:VY:Zabcdefgijklmo:pr:s:tvwxz") #endif ) != -1) { @@ -4148,11 +4142,6 @@ int main(int argc, char **argv) quotestr = mallocstrcpy(quotestr, optarg); break; #endif -#ifdef HAVE_REGEX_H - case 'R': - SET(USE_REGEXP); - break; -#endif #ifndef NANO_SMALL case 'S': SET(SMOOTHSCROLL); diff --git a/src/nano.h b/src/nano.h index e6efdcbf..5859de62 100644 --- a/src/nano.h +++ b/src/nano.h @@ -398,6 +398,7 @@ typedef struct syntaxtype { #define NANO_WHEREIS_NEXT_KEY NANO_ALT_W #define NANO_WHEREIS_NEXT_FKEY KEY_F(16) #define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T +#define NANO_REGEXP_KEY NANO_ALT_R #define NANO_REPLACE_KEY NANO_CONTROL_4 #define NANO_REPLACE_FKEY KEY_F(14) #define NANO_ALT_REPLACE_KEY NANO_ALT_R @@ -467,7 +468,6 @@ typedef struct syntaxtype { #define TOGGLE_NOHELP_KEY NANO_ALT_X #define TOGGLE_MOUSE_KEY NANO_ALT_M #define TOGGLE_CUTTOEND_KEY NANO_ALT_K -#define TOGGLE_REGEXP_KEY NANO_ALT_R #define TOGGLE_WRAP_KEY NANO_ALT_L #define TOGGLE_BACKWARDS_KEY NANO_ALT_B #define TOGGLE_CASE_KEY NANO_ALT_C diff --git a/src/rcfile.c b/src/rcfile.c index 64007e3b..84c3ef85 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -79,9 +79,6 @@ const static rcoption rcopts[] = { {"quotestr", 0}, #endif {"rebinddelete", REBIND_DELETE}, -#ifdef HAVE_REGEX_H - {"regexp", USE_REGEXP}, -#endif #ifndef NANO_SMALL {"smarthome", SMART_HOME}, {"smooth", SMOOTHSCROLL}, diff --git a/src/search.c b/src/search.c index 688acb71..da714b6b 100644 --- a/src/search.c +++ b/src/search.c @@ -238,13 +238,13 @@ int search_init(bool replacing, bool use_answer) TOGGLE(REVERSE_SEARCH); backupstring = mallocstrcpy(backupstring, answer); return 1; +#endif #ifdef HAVE_REGEX_H - case TOGGLE_REGEXP_KEY: + case NANO_REGEXP_KEY: TOGGLE(USE_REGEXP); backupstring = mallocstrcpy(backupstring, answer); return 1; #endif -#endif /* !NANO_SMALL */ case NANO_TOOTHERSEARCH_KEY: backupstring = mallocstrcpy(backupstring, answer); return -2; /* Call the opposite search function. */ @@ -457,11 +457,9 @@ void do_search(void) search_abort(); else if (i == -2) /* Replace. */ do_replace(); -#ifndef NANO_SMALL else if (i == 1) /* Case Sensitive, Backwards, or Regexp search * toggle. */ do_search(); -#endif if (i != 0) return; -- 2.39.5