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
This commit is contained in:
Benno Schulenberg 2015-11-21 19:44:27 +00:00
parent c9e8370cec
commit 1f027a838e
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2015-11-21 Benno Schulenberg <bensberg@justemail.net>
* 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 <pooka109@gmail.com>
* ChangeLog, NEWS: Fix a typo and adjust some spacing.

View File

@ -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