From 736fbf2e3f3fc5050326a14c299a24545b6df4a9 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 13 Jun 2014 15:20:26 +0000 Subject: [PATCH] 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 --- ChangeLog | 4 ++++ doc/man/nano.1 | 9 +++------ doc/man/nanorc.5 | 8 +++----- doc/texinfo/nano.texi | 15 ++++----------- src/global.c | 16 ++++++---------- src/nano.c | 13 ++----------- src/nano.h | 1 - src/rcfile.c | 4 ---- src/text.c | 6 ------ 9 files changed, 22 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6bfb2214..2ceced9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ * 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 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 * src/winio.c (get_mouseinput): Produce the correct return value for diff --git a/doc/man/nano.1 b/doc/man/nano.1 index af07d61d..48be089d 100644 --- a/doc/man/nano.1 +++ b/doc/man/nano.1 @@ -1,4 +1,6 @@ .\" Hey, EMACS: -*- nroff -*- +.\" $Id$ +.\" .\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, .\" 2009, 2010, 2013, 2014 Free Software Foundation, Inc. .\" @@ -18,8 +20,7 @@ .\" Documentation License along with this program. If not, see .\" . .\" -.\" $Id$ -.TH NANO 1 "version 2.3.3" "April 2014" +.TH NANO 1 "version 2.3.5" "June 2014" .\" 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 option. .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) View-file (read-only) mode. .TP diff --git a/doc/man/nanorc.5 b/doc/man/nanorc.5 index b677ff9e..78880249 100644 --- a/doc/man/nanorc.5 +++ b/doc/man/nanorc.5 @@ -1,4 +1,6 @@ .\" Hey, EMACS: -*- nroff -*- +.\" $Id$ +.\" .\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, .\" 2013, 2014 Free Software Foundation, Inc. .\" @@ -18,8 +20,7 @@ .\" Documentation License along with this program. If not, see .\" . .\" -.\" $Id$ -.TH NANORC 5 "version 2.3.3" "May 2014" +.TH NANORC 5 "version 2.3.5" "June 2014" .\" Please adjust this date whenever revising the manpage. .\" .SH NAME @@ -232,9 +233,6 @@ Valid color names for foreground and background are: .BR white , \ black , \ red , \ blue , \ green , \ yellow , \ magenta ", and " cyan . And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out. .TP -.B set/unset undo -Enable the experimental generic-purpose undo/redo code. -.TP .B set/unset view Disallow file modification. .TP diff --git a/doc/texinfo/nano.texi b/doc/texinfo/nano.texi index c72d4223..a494a8b3 100644 --- a/doc/texinfo/nano.texi +++ b/doc/texinfo/nano.texi @@ -7,9 +7,9 @@ @c This file has the new style title page commands. @c Run 'makeinfo' rather than 'texinfo-format-buffer'. @smallbook -@set EDITION 0.1 -@set VERSION 2.3.3 -@set UPDATED May 2014 +@set EDITION 0.2 +@set VERSION 2.3.5 +@set UPDATED June 2014 @dircategory Editors @direntry @@ -23,7 +23,7 @@ @titlepage @title GNU @code{nano} @subtitle a small and friendly text editor. -@subtitle version 2.3.3 +@subtitle version 2.3.5 @author Chris Allegretta @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 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 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 @@ -747,9 +743,6 @@ Valid color names for foreground and background are: white, black, red, blue, green, yellow, magenta, and cyan. 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 Disallow file modification. diff --git a/src/global.c b/src/global.c index c13f7462..b79d8058 100644 --- a/src/global.c +++ b/src/global.c @@ -795,12 +795,10 @@ void shortcut_init(void) add_to_funcs(do_unindent, MMAIN, N_("Unindent Text"), IFSCHELP(nano_unindent_msg), TRUE, NOVIEW); - if (ISSET(UNDOABLE)) { - add_to_funcs(do_undo, MMAIN, - N_("Undo"), IFSCHELP(nano_undo_msg), FALSE, NOVIEW); - add_to_funcs(do_redo, MMAIN, - N_("Redo"), IFSCHELP(nano_redo_msg), TRUE, NOVIEW); - } + add_to_funcs(do_undo, MMAIN, + N_("Undo"), IFSCHELP(nano_undo_msg), FALSE, NOVIEW); + add_to_funcs(do_redo, MMAIN, + N_("Redo"), IFSCHELP(nano_redo_msg), TRUE, NOVIEW); #endif /* !NANO_TINY */ 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-}", do_indent_void, 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-E", do_redo, 0, TRUE); - } + add_to_sclist(MMAIN, "M-U", do_undo, 0, TRUE); + add_to_sclist(MMAIN, "M-E", do_redo, 0, TRUE); #endif add_to_sclist(MMOST, "^B", do_left, 0, TRUE); add_to_sclist(MMOST, "^F", do_right, 0, TRUE); diff --git a/src/nano.c b/src/nano.c index 9c0f00d2..84de5fe1 100644 --- a/src/nano.c +++ b/src/nano.c @@ -936,10 +936,6 @@ void usage(void) #endif print_opt("-t", "--tempfile", 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)")); #ifndef DISABLE_WRAPPING print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines")); @@ -2201,11 +2197,11 @@ int main(int argc, char **argv) while ((optchr = #ifdef HAVE_GETOPT_LONG getopt_long(argc, argv, - "ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tuvwxz$", + "ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tvwxz$", long_options, NULL) #else getopt(argc, argv, - "ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tuvwxz$") + "ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefghijklmno:pqr:s:tvwxz$") #endif ) != -1) { switch (optchr) { @@ -2365,11 +2361,6 @@ int main(int argc, char **argv) case 't': SET(TEMP_FILE); break; -#ifndef NANO_TINY - case 'u': - SET(UNDOABLE); - break; -#endif case 'v': SET(VIEW_MODE); break; diff --git a/src/nano.h b/src/nano.h index 18f5b68b..4e9a3194 100644 --- a/src/nano.h +++ b/src/nano.h @@ -537,7 +537,6 @@ enum NO_NEWLINES, BOLD_TEXT, QUIET, - UNDOABLE, SOFTWRAP, POS_HISTORY, LOCKING, diff --git a/src/rcfile.c b/src/rcfile.c index 6d3cdaf1..719db882 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -95,7 +95,6 @@ static const rcoption rcopts[] = { {"smarthome", SMART_HOME}, {"smooth", SMOOTH_SCROLL}, {"tabstospaces", TABS_TO_SPACES}, - {"undo", UNDOABLE}, {"whitespace", 0}, {"wordbounds", WORD_BOUNDS}, {"softwrap", SOFTWRAP}, @@ -1265,9 +1264,6 @@ void parse_rcfile(FILE *rcstream else rcfile_error(N_("Cannot unset option \"%s\""), rcopts[i].name); - /* If undo/redo was enabled, reinitialize the lists. */ - if (strcasecmp(rcopts[i].name, "undo") == 0) - shortcut_init(); break; } } diff --git a/src/text.c b/src/text.c index ed0ec452..6e025765 100644 --- a/src/text.c +++ b/src/text.c @@ -854,9 +854,6 @@ void add_undo(undo_type current_action) openfilestruct *fs = openfile; /* 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 * on the same lineno, we need to abort here. */ u = fs->current_undo; @@ -996,9 +993,6 @@ void update_undo(undo_type action) undo *u; openfilestruct *fs = openfile; - if (!ISSET(UNDOABLE)) - return; - #ifdef DEBUG fprintf(stderr, "action = %d, fs->last_action = %d, openfile->current->lineno = %ld", action, fs->last_action, (long)openfile->current->lineno); -- 2.39.5