diff --git a/ChangeLog b/ChangeLog index bbfde07ef48310981678e74edb408416cd205e8a..944f18f9b7f02f58ba7fd7c85f4a52c726cf659d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,7 +38,9 @@ CVS code - errors. Also exit instead of calling usage() in the event of an invalid fill value, for consistency with how an invalid tabsize value is handled. Finally, handle invalid tabsize - entries in the rcfile the same way as on the command line. + entries in the rcfile the same way as on the command line, + and reset tabsize and wrap_at to their default values if + invalid rcfile entries are specified for them. - Remove several unnecessary reset_cursor() calls. (David Benbennick) - Include <sys/types.h> in proto.h. (David Benbennick) DLR: diff --git a/src/nano.c b/src/nano.c index d280bc9e23b743d4c3b97596ff88e6136a05da07..992f893cfb714c8cff80821d77cc575ff039aad1 100644 --- a/src/nano.c +++ b/src/nano.c @@ -3336,7 +3336,7 @@ int main(int argc, char *argv[]) alt_speller = alt_speller_cpy; } #endif - if (tabsize_cpy > 0) + if (tabsize_cpy != -1) tabsize = tabsize_cpy; flags |= flags_cpy; } diff --git a/src/rcfile.c b/src/rcfile.c index 5733d9ce33e21907cd30fe94c41795606d5a26c5..bfc1ea2c6d29a3b0f2fddcc041e55332a03f550b 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -420,8 +420,7 @@ void parse_colors(char *ptr) if (tmpsyntax->color == NULL) { tmpsyntax->color = newcolor; #ifdef DEBUG - fprintf(stderr, "Starting a new colorstring for fg %d bg %d\n", - fg, bg); + fprintf(stderr, "Starting a new colorstring for fg %d bg %d\n", fg, bg); #endif } else { for (tmpcolor = tmpsyntax->color; tmpcolor->next != NULL; @@ -563,8 +562,10 @@ void parse_rcfile(FILE *rcstream) #endif #ifndef DISABLE_WRAPJUSTIFY if (!strcasecmp(rcopts[i].name, "fill")) { - if (parse_num(option, &wrap_at) == -1) + if (parse_num(option, &wrap_at) == -1) { rcfile_error(N_("Requested fill size %s invalid"), option); + wrap_at = -CHARS_FROM_EOL; + } } else #endif #ifndef NANO_SMALL @@ -609,9 +610,9 @@ void parse_rcfile(FILE *rcstream) else #endif if (!strcasecmp(rcopts[i].name, "tabsize")) { - if (parse_num(option, &tabsize) == -1 || - tabsize <= 0) + if (parse_num(option, &tabsize) == -1 || tabsize <= 0) rcfile_error(N_("Requested tab size %s invalid"), option); + tabsize = -1; } } else SET(rcopts[i].flag);