options: remove -f (--finalnewline); go back to auto-adding this newline

For relatively inexperienced users (as most users of nano probably are)
it is far better that nano produces POSIX text files by default, where
each line ends with a newline character.  This means that these files
will "print" properly (not gluing the next prompt at the end of the
last line), tools will see and process each line of them, and, while
editing, adding text at the end is easier.

This addresses https://savannah.gnu.org/bugs/?55997.
Reported-by: Ralph Corderoy <ralph@inputplus.co.uk>
master
Benno Schulenberg 2019-04-07 09:01:52 +02:00
parent 5601b9a66b
commit 2552307064
3 changed files with 4 additions and 19 deletions

View File

@ -797,7 +797,7 @@ void usage(void)
N_("Fix numeric keypad key confusion problem")); N_("Fix numeric keypad key confusion problem"));
#ifndef NANO_TINY #ifndef NANO_TINY
print_opt("-L", "--nonewlines", print_opt("-L", "--nonewlines",
N_("Don't add an automatic newline [default]")); N_("Don't add an automatic newline"));
#endif #endif
#ifdef ENABLED_WRAPORJUSTIFY #ifdef ENABLED_WRAPORJUSTIFY
print_opt("-M", "--trimblanks", print_opt("-M", "--trimblanks",
@ -844,7 +844,6 @@ void usage(void)
print_opt("-d", "--rebinddelete", print_opt("-d", "--rebinddelete",
N_("Fix Backspace/Delete confusion problem")); N_("Fix Backspace/Delete confusion problem"));
print_opt("-e", "--emptyline", N_("Keep the line below the title bar empty")); print_opt("-e", "--emptyline", N_("Keep the line below the title bar empty"));
print_opt("-f", "--finalnewline", N_("Ensure that text ends with a newline"));
#ifdef ENABLE_BROWSER #ifdef ENABLE_BROWSER
if (!ISSET(RESTRICTED)) if (!ISSET(RESTRICTED))
print_opt("-g", "--showcursor", N_("Show cursor in file browser & help text")); print_opt("-g", "--showcursor", N_("Show cursor in file browser & help text"));
@ -1992,7 +1991,6 @@ int main(int argc, char **argv)
{"constantshow", 0, NULL, 'c'}, {"constantshow", 0, NULL, 'c'},
{"rebinddelete", 0, NULL, 'd'}, {"rebinddelete", 0, NULL, 'd'},
{"emptyline", 0, NULL, 'e'}, {"emptyline", 0, NULL, 'e'},
{"finalnewline", 0, NULL, 'f'},
#ifdef ENABLE_BROWSER #ifdef ENABLE_BROWSER
{"showcursor", 0, NULL, 'g'}, {"showcursor", 0, NULL, 'g'},
#endif #endif
@ -2090,7 +2088,6 @@ int main(int argc, char **argv)
/* Set sensible defaults, different from what Pico does. */ /* Set sensible defaults, different from what Pico does. */
SET(NO_WRAP); SET(NO_WRAP);
SET(NO_NEWLINES);
SET(SMOOTH_SCROLL); SET(SMOOTH_SCROLL);
/* Give a small visual hint that nano has changed. */ /* Give a small visual hint that nano has changed. */
@ -2102,7 +2099,7 @@ int main(int argc, char **argv)
while ((optchr = while ((optchr =
getopt_long(argc, argv, getopt_long(argc, argv,
"ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Zabcdefghijklmno:pr:s:tuvwxyz$", "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Zabcdeghijklmno:pr:s:tuvwxyz$",
long_options, NULL)) != -1) { long_options, NULL)) != -1) {
switch (optchr) { switch (optchr) {
#ifndef NANO_TINY #ifndef NANO_TINY
@ -2158,7 +2155,7 @@ int main(int argc, char **argv)
break; break;
#ifndef NANO_TINY #ifndef NANO_TINY
case 'L': case 'L':
UNSET(FINAL_NEWLINE); SET(NO_NEWLINES);
break; break;
#endif #endif
#ifdef ENABLED_WRAPORJUSTIFY #ifdef ENABLED_WRAPORJUSTIFY
@ -2242,9 +2239,6 @@ int main(int argc, char **argv)
case 'e': case 'e':
SET(EMPTY_LINE); SET(EMPTY_LINE);
break; break;
case 'f':
SET(FINAL_NEWLINE);
break;
case 'g': case 'g':
SET(SHOW_CURSOR); SET(SHOW_CURSOR);
break; break;
@ -2433,8 +2427,6 @@ int main(int argc, char **argv)
/* If an rcfile undid the default settings, copy it to the new flags. */ /* If an rcfile undid the default settings, copy it to the new flags. */
if (!ISSET(NO_WRAP)) if (!ISSET(NO_WRAP))
SET(BREAK_LONG_LINES); SET(BREAK_LONG_LINES);
if (!ISSET(NO_NEWLINES))
SET(FINAL_NEWLINE);
if (!ISSET(SMOOTH_SCROLL)) if (!ISSET(SMOOTH_SCROLL))
SET(JUMPY_SCROLLING); SET(JUMPY_SCROLLING);
if (!ISSET(MORE_SPACE)) if (!ISSET(MORE_SPACE))
@ -2446,11 +2438,6 @@ int main(int argc, char **argv)
} }
#endif /* ENABLE_NANORC */ #endif /* ENABLE_NANORC */
if (ISSET(FINAL_NEWLINE))
UNSET(NO_NEWLINES);
else
SET(NO_NEWLINES);
/* If the user wants bold instead of reverse video for hilited text... */ /* If the user wants bold instead of reverse video for hilited text... */
if (ISSET(BOLD_TEXT)) if (ISSET(BOLD_TEXT))
hilite_attribute = A_BOLD; hilite_attribute = A_BOLD;

View File

@ -543,7 +543,6 @@ enum
AFTER_ENDS, AFTER_ENDS,
LET_THEM_ZAP, LET_THEM_ZAP,
BREAK_LONG_LINES, BREAK_LONG_LINES,
FINAL_NEWLINE,
JUMPY_SCROLLING, JUMPY_SCROLLING,
EMPTY_LINE EMPTY_LINE
}; };

View File

@ -50,7 +50,6 @@ static const rcoption rcopts[] = {
#ifdef ENABLED_WRAPORJUSTIFY #ifdef ENABLED_WRAPORJUSTIFY
{"fill", 0}, {"fill", 0},
#endif #endif
{"finalnewline", FINAL_NEWLINE},
#ifdef ENABLE_HISTORIES #ifdef ENABLE_HISTORIES
{"historylog", HISTORYLOG}, {"historylog", HISTORYLOG},
#endif #endif
@ -66,7 +65,7 @@ static const rcoption rcopts[] = {
{"multibuffer", MULTIBUFFER}, {"multibuffer", MULTIBUFFER},
#endif #endif
{"nohelp", NO_HELP}, {"nohelp", NO_HELP},
{"nonewlines", NO_NEWLINES}, /* Deprecated; remove in 2021. */ {"nonewlines", NO_NEWLINES},
{"nopauses", NO_PAUSES}, {"nopauses", NO_PAUSES},
#ifdef ENABLE_WRAPPING #ifdef ENABLE_WRAPPING
{"nowrap", NO_WRAP}, /* Deprecated; remove in 2021. */ {"nowrap", NO_WRAP}, /* Deprecated; remove in 2021. */