+2009-07-11 Chris Allegretta <chrisa@asty.org>
+ * nano-regress: Small tweaks
+ * Change undo code to off unless unabled via a command line option (-u/--undo). Until this code
+ stabilizes this is the only responsible way to treat it.
+
2009-03-08 Chris Allegretta <chrisa@asty.org>
* TODO - Break out some targets for various features into 2.2
and 2.4 series for things which are feasible.
Always save changed buffer without prompting. Same as Pico's \fB-t\fP
option.
.TP
+.B \-u (\-\-undo)
+Enable experimental generic-purpose undo code. By default, the undo and redo
+shortcuts are Meta-U and Meta-E, respectively.
+.TP
.B \-v (\-\-view)
View file (read only) mode.
.TP
my @args = @$name;
my $pct = $i / $#combos * 100;
printf "Trying with options: @args, %d%% done...\n", $pct;
- system("(./configure @args && make clean all) >/dev/null 2>&1");
+ my $cmd = "./configure @args && make clean all";
+ system("($cmd) >/dev/null 2>&1");
if ($? != 0) {
print "Build failed for args: @args\n";
- print "Try running make to reproduce\n";
+ print "To reproduce, run:\n $cmd\n";
exit(1);
}
$i++;
bool jump_buf_main = FALSE;
/* Have we set jump_buf so that we return to main() after a
* SIGWINCH? */
+bool use_undo = FALSE;
+ /* Are we actually using the undo code - disabled by default
+ as the undo code is too unstable */
#endif
#ifndef DISABLE_WRAPJUSTIFY
add_to_funcs(DO_UNINDENT, MMAIN, N_("Unindent Text"),
IFSCHELP(nano_unindent_msg), FALSE, NOVIEW);
- add_to_funcs(DO_UNDO, MMAIN, N_("Undo"),
- IFSCHELP(nano_undo_msg), FALSE, NOVIEW);
+ if (use_undo) {
+ 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_REDO, MMAIN, N_("Redo"),
+ IFSCHELP(nano_redo_msg), TRUE, NOVIEW);
+ }
#endif
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);
- add_to_sclist(MMAIN, "M-U", DO_UNDO, 0, TRUE);
- add_to_sclist(MMAIN, "M-E", DO_REDO, 0, TRUE);
+ if (use_undo) {
+ add_to_sclist(MMAIN, "M-U", DO_UNDO, 0, TRUE);
+ add_to_sclist(MMAIN, "M-E", DO_REDO, 0, TRUE);
+ }
add_to_sclist(MALL, "^F", DO_RIGHT, 0, TRUE);
add_to_sclist(MALL, "^B", DO_LEFT, 0, TRUE);
add_to_sclist(MMAIN, "^Space", DO_NEXT_WORD_VOID, 0, TRUE);
#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 wrap long lines"));
{"noconvert", 0, NULL, 'N'},
{"smooth", 0, NULL, 'S'},
{"quickblank", 0, NULL, 'U'},
+ {"undo", 0, NULL, 'u'},
{"wordbounds", 0, NULL, 'W'},
{"autoindent", 0, NULL, 'i'},
{"cut", 0, NULL, 'k'},
while ((optchr =
#ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv,
- "h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pqr:s:tvwxz",
+ "h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pqr:s:tuvwxz",
long_options, NULL)
#else
getopt(argc, argv,
- "h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pqr:s:tvwxz")
+ "h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pqr:s:tuvwxz")
#endif
) != -1) {
switch (optchr) {
case 't':
SET(TEMP_FILE);
break;
+#ifndef NANO_TINY
+ case 'u':
+ use_undo = TRUE;
+ break;
+#endif
case 'v':
SET(VIEW_MODE);
break;
#ifndef NANO_TINY
extern sigjmp_buf jump_buf;
extern bool jump_buf_main;
+extern bool use_undo;
#endif
#ifndef DISABLE_WRAPJUSTIFY
case ENTER:
undidmsg = _("line break");
if (f->next) {
+ filestruct *foo = f->next;
f->data = nrealloc(f->data, strlen(f->data) + strlen(f->next->data) + 1);
strcat(f->data, f->next->data);
- filestruct *foo = f->next;
unlink_node(foo);
delete_node(foo);
}
void do_redo(void)
{
undo *u = openfile->undotop;
- filestruct *f = openfile->current, *t;
+ filestruct *f = openfile->current;
int len = 0;
char *undidmsg, *data;
static undo *last_cutu = NULL; /* Last thing we cut to set up the undo for uncut */
ssize_t wrap_loc; /* For calculating split beginning */
+ if (!use_undo)
+ 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;
int len = 0;
openfilestruct *fs = openfile;
+ if (!use_undo)
+ return;
+
#ifdef DEBUG
fprintf(stderr, "action = %d, fs->last_action = %d, openfile->current->lineno = %d",
action, fs->last_action, openfile->current->lineno);
break;
case UNSPLIT:
/* These cases are handled by the earlier check for a new line and action */
+ case ENTER:
case OTHER:
break;
}