Removing the --undo option, having the undo functions always enabled.

If wished, the user can unbind them.  This fixes Savannah bug #42456.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4964 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg 2014-06-13 15:20:26 +00:00
parent cd59a646e6
commit 736fbf2e3f
9 changed files with 22 additions and 54 deletions

View File

@ -6,6 +6,10 @@
* src/nano.c (do_input): A toggle should not break a series of ^Ks. * src/nano.c (do_input): A toggle should not break a series of ^Ks.
* src/winio.c (get_shortcut): Do not treat holding both Control and * src/winio.c (get_shortcut): Do not treat holding both Control and
Meta the same as holding only Control. Meta the same as holding only Control.
* src/global.c, src/rcfile.c, src/nano.h, src/nano.c, src/text.c:
Remove the --undo option, having the undo functions always enabled.
If wished, the user can unbind them. This fixes Savannah bug #42456.
* doc/man/{nano.1,nanorc.5}, doc/texinfo/nano.texi: Update the docs.
2014-06-11 Benno Schulenberg <bensberg@justemail.net> 2014-06-11 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (get_mouseinput): Produce the correct return value for * src/winio.c (get_mouseinput): Produce the correct return value for

View File

@ -1,4 +1,6 @@
.\" Hey, EMACS: -*- nroff -*- .\" Hey, EMACS: -*- nroff -*-
.\" $Id$
.\"
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, .\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
.\" 2009, 2010, 2013, 2014 Free Software Foundation, Inc. .\" 2009, 2010, 2013, 2014 Free Software Foundation, Inc.
.\" .\"
@ -18,8 +20,7 @@
.\" Documentation License along with this program. If not, see .\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>. .\" <http://www.gnu.org/licenses/>.
.\" .\"
.\" $Id$ .TH NANO 1 "version 2.3.5" "June 2014"
.TH NANO 1 "version 2.3.3" "April 2014"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
@ -200,10 +201,6 @@ Enable alternative spell checker command.
Always save changed buffer without prompting. Same as Pico's \fB\-t\fP Always save changed buffer without prompting. Same as Pico's \fB\-t\fP
option. option.
.TP .TP
.B \-u (\-\-undo)
Enable the experimental generic-purpose undo/redo code. The default undo
and redo shortcuts are Meta-U and Meta-E, respectively.
.TP
.B \-v (\-\-view) .B \-v (\-\-view)
View-file (read-only) mode. View-file (read-only) mode.
.TP .TP

View File

@ -1,4 +1,6 @@
.\" Hey, EMACS: -*- nroff -*- .\" Hey, EMACS: -*- nroff -*-
.\" $Id$
.\"
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, .\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
.\" 2013, 2014 Free Software Foundation, Inc. .\" 2013, 2014 Free Software Foundation, Inc.
.\" .\"
@ -18,8 +20,7 @@
.\" Documentation License along with this program. If not, see .\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>. .\" <http://www.gnu.org/licenses/>.
.\" .\"
.\" $Id$ .TH NANORC 5 "version 2.3.5" "June 2014"
.TH NANORC 5 "version 2.3.3" "May 2014"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.SH NAME .SH NAME
@ -232,9 +233,6 @@ Valid color names for foreground and background are:
.BR white , \ black , \ red , \ blue , \ green , \ yellow , \ magenta ", and " cyan . .BR white , \ black , \ red , \ blue , \ green , \ yellow , \ magenta ", and " cyan .
And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out. And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
.TP .TP
.B set/unset undo
Enable the experimental generic-purpose undo/redo code.
.TP
.B set/unset view .B set/unset view
Disallow file modification. Disallow file modification.
.TP .TP

View File

@ -7,9 +7,9 @@
@c This file has the new style title page commands. @c This file has the new style title page commands.
@c Run 'makeinfo' rather than 'texinfo-format-buffer'. @c Run 'makeinfo' rather than 'texinfo-format-buffer'.
@smallbook @smallbook
@set EDITION 0.1 @set EDITION 0.2
@set VERSION 2.3.3 @set VERSION 2.3.5
@set UPDATED May 2014 @set UPDATED June 2014
@dircategory Editors @dircategory Editors
@direntry @direntry
@ -23,7 +23,7 @@
@titlepage @titlepage
@title GNU @code{nano} @title GNU @code{nano}
@subtitle a small and friendly text editor. @subtitle a small and friendly text editor.
@subtitle version 2.3.3 @subtitle version 2.3.5
@author Chris Allegretta @author Chris Allegretta
@page @page
@ -289,10 +289,6 @@ Don't ask whether or not to save the current contents of the file when
exiting, assume yes. This is most useful when using @code{nano} as the exiting, assume yes. This is most useful when using @code{nano} as the
composer of a mailer program. composer of a mailer program.
@item -u, --undo
Enable the experimental generic-purpose undo/redo code. The default undo
and redo shortcuts are Meta-U and Meta-E, respectively.
@item -v, --view @item -v, --view
Don't allow the contents of the file to be altered. Note that this Don't allow the contents of the file to be altered. Note that this
option should NOT be used in place of correct file permissions to option should NOT be used in place of correct file permissions to
@ -747,9 +743,6 @@ Valid color names for foreground and background are:
white, black, red, blue, green, yellow, magenta, and cyan. white, black, red, blue, green, yellow, magenta, and cyan.
And either "fgcolor" or ",bgcolor" may be left out. And either "fgcolor" or ",bgcolor" may be left out.
@item set/unset undo
Enable the experimental generic-purpose undo/redo code.
@item set/unset view @item set/unset view
Disallow file modification. Disallow file modification.

View File

@ -795,12 +795,10 @@ void shortcut_init(void)
add_to_funcs(do_unindent, MMAIN, add_to_funcs(do_unindent, MMAIN,
N_("Unindent Text"), IFSCHELP(nano_unindent_msg), TRUE, NOVIEW); N_("Unindent Text"), IFSCHELP(nano_unindent_msg), TRUE, NOVIEW);
if (ISSET(UNDOABLE)) { add_to_funcs(do_undo, MMAIN,
add_to_funcs(do_undo, MMAIN, N_("Undo"), IFSCHELP(nano_undo_msg), FALSE, NOVIEW);
N_("Undo"), IFSCHELP(nano_undo_msg), FALSE, NOVIEW); add_to_funcs(do_redo, MMAIN,
add_to_funcs(do_redo, MMAIN, N_("Redo"), IFSCHELP(nano_redo_msg), TRUE, NOVIEW);
N_("Redo"), IFSCHELP(nano_redo_msg), TRUE, NOVIEW);
}
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
add_to_funcs(do_left, MMAIN, add_to_funcs(do_left, MMAIN,
@ -1032,10 +1030,8 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-6", do_copy_text, 0, TRUE); add_to_sclist(MMAIN, "M-6", do_copy_text, 0, TRUE);
add_to_sclist(MMAIN, "M-}", do_indent_void, 0, TRUE); add_to_sclist(MMAIN, "M-}", do_indent_void, 0, TRUE);
add_to_sclist(MMAIN, "M-{", do_unindent, 0, TRUE); add_to_sclist(MMAIN, "M-{", do_unindent, 0, TRUE);
if (ISSET(UNDOABLE)) { add_to_sclist(MMAIN, "M-U", do_undo, 0, TRUE);
add_to_sclist(MMAIN, "M-U", do_undo, 0, TRUE); add_to_sclist(MMAIN, "M-E", do_redo, 0, TRUE);
add_to_sclist(MMAIN, "M-E", do_redo, 0, TRUE);
}
#endif #endif
add_to_sclist(MMOST, "^B", do_left, 0, TRUE); add_to_sclist(MMOST, "^B", do_left, 0, TRUE);
add_to_sclist(MMOST, "^F", do_right, 0, TRUE); add_to_sclist(MMOST, "^F", do_right, 0, TRUE);

View File

@ -936,10 +936,6 @@ void usage(void)
#endif #endif
print_opt("-t", "--tempfile", print_opt("-t", "--tempfile",
N_("Auto save on exit, don't prompt")); N_("Auto save on exit, don't prompt"));
#ifndef NANO_TINY
print_opt("-u", "--undo", N_("Allow generic undo [EXPERIMENTAL]"));
#endif
print_opt("-v", "--view", N_("View mode (read-only)")); print_opt("-v", "--view", N_("View mode (read-only)"));
#ifndef DISABLE_WRAPPING #ifndef DISABLE_WRAPPING
print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines")); print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines"));
@ -2201,11 +2197,11 @@ int main(int argc, char **argv)
while ((optchr = while ((optchr =
#ifdef HAVE_GETOPT_LONG #ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv, getopt_long(argc, argv,
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tuvwxz$", "ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tvwxz$",
long_options, NULL) long_options, NULL)
#else #else
getopt(argc, argv, getopt(argc, argv,
"ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tuvwxz$") "ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tvwxz$")
#endif #endif
) != -1) { ) != -1) {
switch (optchr) { switch (optchr) {
@ -2365,11 +2361,6 @@ int main(int argc, char **argv)
case 't': case 't':
SET(TEMP_FILE); SET(TEMP_FILE);
break; break;
#ifndef NANO_TINY
case 'u':
SET(UNDOABLE);
break;
#endif
case 'v': case 'v':
SET(VIEW_MODE); SET(VIEW_MODE);
break; break;

View File

@ -537,7 +537,6 @@ enum
NO_NEWLINES, NO_NEWLINES,
BOLD_TEXT, BOLD_TEXT,
QUIET, QUIET,
UNDOABLE,
SOFTWRAP, SOFTWRAP,
POS_HISTORY, POS_HISTORY,
LOCKING, LOCKING,

View File

@ -95,7 +95,6 @@ static const rcoption rcopts[] = {
{"smarthome", SMART_HOME}, {"smarthome", SMART_HOME},
{"smooth", SMOOTH_SCROLL}, {"smooth", SMOOTH_SCROLL},
{"tabstospaces", TABS_TO_SPACES}, {"tabstospaces", TABS_TO_SPACES},
{"undo", UNDOABLE},
{"whitespace", 0}, {"whitespace", 0},
{"wordbounds", WORD_BOUNDS}, {"wordbounds", WORD_BOUNDS},
{"softwrap", SOFTWRAP}, {"softwrap", SOFTWRAP},
@ -1265,9 +1264,6 @@ void parse_rcfile(FILE *rcstream
else else
rcfile_error(N_("Cannot unset option \"%s\""), rcfile_error(N_("Cannot unset option \"%s\""),
rcopts[i].name); rcopts[i].name);
/* If undo/redo was enabled, reinitialize the lists. */
if (strcasecmp(rcopts[i].name, "undo") == 0)
shortcut_init();
break; break;
} }
} }

View File

@ -854,9 +854,6 @@ void add_undo(undo_type current_action)
openfilestruct *fs = openfile; openfilestruct *fs = openfile;
/* Last thing we cut to set up the undo for uncut. */ /* Last thing we cut to set up the undo for uncut. */
if (!ISSET(UNDOABLE))
return;
/* Ugh, if we were called while cutting not-to-end, non-marked, and /* Ugh, if we were called while cutting not-to-end, non-marked, and
* on the same lineno, we need to abort here. */ * on the same lineno, we need to abort here. */
u = fs->current_undo; u = fs->current_undo;
@ -996,9 +993,6 @@ void update_undo(undo_type action)
undo *u; undo *u;
openfilestruct *fs = openfile; openfilestruct *fs = openfile;
if (!ISSET(UNDOABLE))
return;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "action = %d, fs->last_action = %d, openfile->current->lineno = %ld", fprintf(stderr, "action = %d, fs->last_action = %d, openfile->current->lineno = %ld",
action, fs->last_action, (long)openfile->current->lineno); action, fs->last_action, (long)openfile->current->lineno);