From: Benno Schulenberg Date: Sat, 21 Nov 2015 19:44:27 +0000 (+0000) Subject: Letting the value of a --fill option on the command line X-Git-Tag: v2.5.0~55 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=1f027a838e1bc14e43d522925f9045d19336532a;p=nano.git Letting the value of a --fill option on the command line override the value of a "set fill" option in an rcfile. This fixes Savannah bug #46492. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5428 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index e80fb76f..c3be5e2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-11-21 Benno Schulenberg + * src/nano.c (main): Let the value of a --fill option on the + command line override the value of a "set fill" in an rcfile. + This fixes Savannah bug #46492. + 2015-11-21 David Lawrence Ramsey * ChangeLog, NEWS: Fix a typo and adjust some spacing. diff --git a/src/nano.c b/src/nano.c index 0886eeec..333f08c4 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2109,7 +2109,9 @@ int main(int argc, char **argv) /* Target line and column when specified on the command line. */ #ifndef DISABLE_WRAPJUSTIFY bool fill_used = FALSE; - /* Was the fill option used? */ + /* Was the fill option used on the command line? */ + bool forced_wrapping = FALSE; + /* Should long lines be automatically hard wrapped? */ #endif #ifndef DISABLE_MULTIBUFFER bool old_multibuffer; @@ -2382,6 +2384,7 @@ int main(int argc, char **argv) exit(1); } fill_used = TRUE; + forced_wrapping = TRUE; break; #endif #ifndef DISABLE_SPELLER @@ -2405,7 +2408,7 @@ int main(int argc, char **argv) SET(NO_WRAP); /* If both --fill and --nowrap are given on the * command line, the last given option wins. */ - fill_used = FALSE; + forced_wrapping = FALSE; break; #endif case 'x': @@ -2539,9 +2542,9 @@ int main(int argc, char **argv) #endif /* !DISABLE_NANORC */ #ifndef DISABLE_WRAPPING - /* Override an rcfile "set nowrap" or --disable-wrapping-as-root - * if a --fill option was given on the command line. */ - if (fill_used) + /* Override a "set nowrap" in an rcfile (or a --disable-wrapping-as-root) + * if --fill was given on the command line and not undone by --nowrap. */ + if (forced_wrapping) UNSET(NO_WRAP); #endif