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-d3aeb78583b8master
parent
8fda94246b
commit
c10d8ffe9f
|
@ -46,6 +46,14 @@ CVS code -
|
||||||
Changes to safe_tempnam() (renamed safe_tempfile()),
|
Changes to safe_tempnam() (renamed safe_tempfile()),
|
||||||
write_file(), write_marked(), die(), do_spell(), and
|
write_file(), write_marked(), die(), do_spell(), and
|
||||||
do_exit(). (DLR)
|
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.c:
|
||||||
cut_line()
|
cut_line()
|
||||||
- Set placewewant properly after cutting a line, to avoid a
|
- Set placewewant properly after cutting a line, to avoid a
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
.\" Public License for copying conditions. There is NO warranty.
|
.\" Public License for copying conditions. There is NO warranty.
|
||||||
.\"
|
.\"
|
||||||
.\" $Id$
|
.\" $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.
|
.\" 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
|
"^([\ \\t]*[|>:}#])+" if regular expression support is available, or
|
||||||
">\ " otherwise.
|
">\ " otherwise.
|
||||||
.TP
|
.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)
|
.B \-S (\-\-smooth)
|
||||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||||
usual chunk-by-chunk behavior.
|
usual chunk-by-chunk behavior.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
.\" Public License for copying conditions. There is NO warranty.
|
.\" Public License for copying conditions. There is NO warranty.
|
||||||
.\"
|
.\"
|
||||||
.\" $Id$
|
.\" $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.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
.SH NAME
|
.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
|
work properly. You should only need to use this option if Backspace
|
||||||
acts like Delete on your system.
|
acts like Delete on your system.
|
||||||
.TP
|
.TP
|
||||||
\fBset/unset regexp\fP
|
|
||||||
Do regular expression searches by default.
|
|
||||||
.TP
|
|
||||||
\fBset/unset smarthome\fP
|
\fBset/unset smarthome\fP
|
||||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
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
|
very beginning of non-whitespace characters on a line, the cursor will
|
||||||
|
|
|
@ -91,9 +91,6 @@
|
||||||
## Fix Backspace/Delete confusion problem.
|
## Fix Backspace/Delete confusion problem.
|
||||||
# set rebinddelete
|
# set rebinddelete
|
||||||
|
|
||||||
## Do extended regular expression searches by default.
|
|
||||||
# set regexp
|
|
||||||
|
|
||||||
## Make the Home key smarter. When Home is pressed anywhere but at the
|
## Make the Home key smarter. When Home is pressed anywhere but at the
|
||||||
## very beginning of non-whitespace characters on a line, the cursor
|
## very beginning of non-whitespace characters on a line, the cursor
|
||||||
## will jump to that beginning (either forwards or backwards). If the
|
## will jump to that beginning (either forwards or backwards). If the
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
@smallbook
|
@smallbook
|
||||||
@set EDITION 0.1
|
@set EDITION 0.1
|
||||||
@set VERSION 1.3.8
|
@set VERSION 1.3.8
|
||||||
@set UPDATED 29 May 2005
|
@set UPDATED 03 Jun 2005
|
||||||
|
|
||||||
@dircategory Editors
|
@dircategory Editors
|
||||||
@direntry
|
@direntry
|
||||||
|
@ -148,9 +148,6 @@ Set the quoting string for justifying. The default is
|
||||||
if regular expression support is available, or ``> '' otherwise. Note
|
if regular expression support is available, or ``> '' otherwise. Note
|
||||||
that @code{\t} above stands for a literal Tab character.
|
that @code{\t} above stands for a literal Tab character.
|
||||||
|
|
||||||
@item -R, --regexp
|
|
||||||
Turn on regular expression search and search/replace.
|
|
||||||
|
|
||||||
@item -S, --smooth
|
@item -S, --smooth
|
||||||
Enable smooth scrolling.
|
Enable smooth scrolling.
|
||||||
|
|
||||||
|
|
22
src/global.c
22
src/global.c
|
@ -253,18 +253,19 @@ void shortcut_init(bool unjustify)
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
const char *case_sens_msg = N_("Case Sens");
|
const char *case_sens_msg = N_("Case Sens");
|
||||||
const char *direction_msg = N_("Direction");
|
const char *direction_msg = N_("Direction");
|
||||||
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
const char *regexp_msg = N_("Regexp");
|
const char *regexp_msg = N_("Regexp");
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
const char *history_msg = N_("History");
|
const char *history_msg = N_("History");
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
const char *new_buffer_msg = N_("New Buffer");
|
const char *new_buffer_msg = N_("New Buffer");
|
||||||
#endif
|
#endif
|
||||||
#endif /* !NANO_SMALL */
|
#endif
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
const char *to_files_msg = N_("To Files");
|
const char *to_files_msg = N_("To Files");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
const char *nano_help_msg = N_("Invoke the help menu");
|
const char *nano_help_msg = N_("Invoke the help menu");
|
||||||
const char *nano_exit_msg =
|
const char *nano_exit_msg =
|
||||||
|
@ -341,13 +342,14 @@ void shortcut_init(bool unjustify)
|
||||||
N_("Make the current search/replace case (in)sensitive");
|
N_("Make the current search/replace case (in)sensitive");
|
||||||
const char *nano_reverse_msg =
|
const char *nano_reverse_msg =
|
||||||
N_("Make the current search/replace go backwards");
|
N_("Make the current search/replace go backwards");
|
||||||
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
const char *nano_regexp_msg = N_("Use regular expressions");
|
const char *nano_regexp_msg = N_("Use regular expressions");
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
const char *nano_history_msg =
|
const char *nano_history_msg =
|
||||||
N_("Edit the previous search/replace strings");
|
N_("Edit the previous search/replace strings");
|
||||||
#endif /* !NANO_SMALL */
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
const char *nano_tofiles_msg = N_("Go to file browser");
|
const char *nano_tofiles_msg = N_("Go to file browser");
|
||||||
#endif
|
#endif
|
||||||
|
@ -660,14 +662,16 @@ void shortcut_init(bool unjustify)
|
||||||
sc_init_one(&whereis_list, NANO_NO_KEY, direction_msg,
|
sc_init_one(&whereis_list, NANO_NO_KEY, direction_msg,
|
||||||
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
|
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, VIEW, NULL);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&whereis_list, NANO_NO_KEY, regexp_msg,
|
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);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg,
|
sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg,
|
||||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
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,
|
sc_init_one(&whereis_list, NANO_CUTTILLEND_KEY, cut_till_end_msg,
|
||||||
IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY),
|
IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY),
|
||||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
|
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
|
||||||
#endif /* !NANO_SMALL */
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* 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,
|
sc_init_one(&replace_list, NANO_NO_KEY, direction_msg,
|
||||||
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
|
IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, VIEW, NULL);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg,
|
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);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg,
|
sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg,
|
||||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, VIEW, NULL);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
#endif /* !NANO_SMALL */
|
#endif
|
||||||
|
|
||||||
free_shortcutage(&replace_list_2);
|
free_shortcutage(&replace_list_2);
|
||||||
|
|
||||||
|
|
15
src/nano.c
15
src/nano.c
|
@ -1042,9 +1042,6 @@ void usage(void)
|
||||||
print1opt(_("-Q [str]"), _("--quotestr=[str]"),
|
print1opt(_("-Q [str]"), _("--quotestr=[str]"),
|
||||||
N_("Quoting string, default \"> \""));
|
N_("Quoting string, default \"> \""));
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
print1opt("-R", "--regexp", N_("Do regular expression searches"));
|
|
||||||
#endif
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
print1opt("-S", "--smooth", N_("Smooth scrolling"));
|
print1opt("-S", "--smooth", N_("Smooth scrolling"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -4013,9 +4010,6 @@ int main(int argc, char **argv)
|
||||||
{"morespace", 0, NULL, 'O'},
|
{"morespace", 0, NULL, 'O'},
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
{"quotestr", 1, NULL, 'Q'},
|
{"quotestr", 1, NULL, 'Q'},
|
||||||
#endif
|
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
{"regexp", 0, NULL, 'R'},
|
|
||||||
#endif
|
#endif
|
||||||
{"tabsize", 1, NULL, 'T'},
|
{"tabsize", 1, NULL, 'T'},
|
||||||
{"version", 0, NULL, 'V'},
|
{"version", 0, NULL, 'V'},
|
||||||
|
@ -4094,9 +4088,9 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
while ((optchr =
|
while ((optchr =
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#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
|
#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
|
#endif
|
||||||
) != -1) {
|
) != -1) {
|
||||||
|
|
||||||
|
@ -4148,11 +4142,6 @@ int main(int argc, char **argv)
|
||||||
quotestr = mallocstrcpy(quotestr, optarg);
|
quotestr = mallocstrcpy(quotestr, optarg);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
case 'R':
|
|
||||||
SET(USE_REGEXP);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
case 'S':
|
case 'S':
|
||||||
SET(SMOOTHSCROLL);
|
SET(SMOOTHSCROLL);
|
||||||
|
|
|
@ -398,6 +398,7 @@ typedef struct syntaxtype {
|
||||||
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
|
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
|
||||||
#define NANO_WHEREIS_NEXT_FKEY KEY_F(16)
|
#define NANO_WHEREIS_NEXT_FKEY KEY_F(16)
|
||||||
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
|
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
|
||||||
|
#define NANO_REGEXP_KEY NANO_ALT_R
|
||||||
#define NANO_REPLACE_KEY NANO_CONTROL_4
|
#define NANO_REPLACE_KEY NANO_CONTROL_4
|
||||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||||
|
@ -467,7 +468,6 @@ typedef struct syntaxtype {
|
||||||
#define TOGGLE_NOHELP_KEY NANO_ALT_X
|
#define TOGGLE_NOHELP_KEY NANO_ALT_X
|
||||||
#define TOGGLE_MOUSE_KEY NANO_ALT_M
|
#define TOGGLE_MOUSE_KEY NANO_ALT_M
|
||||||
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
||||||
#define TOGGLE_REGEXP_KEY NANO_ALT_R
|
|
||||||
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
||||||
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
||||||
#define TOGGLE_CASE_KEY NANO_ALT_C
|
#define TOGGLE_CASE_KEY NANO_ALT_C
|
||||||
|
|
|
@ -79,9 +79,6 @@ const static rcoption rcopts[] = {
|
||||||
{"quotestr", 0},
|
{"quotestr", 0},
|
||||||
#endif
|
#endif
|
||||||
{"rebinddelete", REBIND_DELETE},
|
{"rebinddelete", REBIND_DELETE},
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
{"regexp", USE_REGEXP},
|
|
||||||
#endif
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
{"smarthome", SMART_HOME},
|
{"smarthome", SMART_HOME},
|
||||||
{"smooth", SMOOTHSCROLL},
|
{"smooth", SMOOTHSCROLL},
|
||||||
|
|
|
@ -238,13 +238,13 @@ int search_init(bool replacing, bool use_answer)
|
||||||
TOGGLE(REVERSE_SEARCH);
|
TOGGLE(REVERSE_SEARCH);
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return 1;
|
return 1;
|
||||||
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
case TOGGLE_REGEXP_KEY:
|
case NANO_REGEXP_KEY:
|
||||||
TOGGLE(USE_REGEXP);
|
TOGGLE(USE_REGEXP);
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
#endif /* !NANO_SMALL */
|
|
||||||
case NANO_TOOTHERSEARCH_KEY:
|
case NANO_TOOTHERSEARCH_KEY:
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return -2; /* Call the opposite search function. */
|
return -2; /* Call the opposite search function. */
|
||||||
|
@ -457,11 +457,9 @@ void do_search(void)
|
||||||
search_abort();
|
search_abort();
|
||||||
else if (i == -2) /* Replace. */
|
else if (i == -2) /* Replace. */
|
||||||
do_replace();
|
do_replace();
|
||||||
#ifndef NANO_SMALL
|
|
||||||
else if (i == 1) /* Case Sensitive, Backwards, or Regexp search
|
else if (i == 1) /* Case Sensitive, Backwards, or Regexp search
|
||||||
* toggle. */
|
* toggle. */
|
||||||
do_search();
|
do_search();
|
||||||
#endif
|
|
||||||
|
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue