[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 01/15] options: add -b, --breaklonglines, the counte
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] [PATCH 01/15] options: add -b, --breaklonglines, the counterpart of --nowrap |
Date: |
Thu, 31 Jan 2019 17:49:27 +0100 |
---
src/nano.c | 31 +++++++++++++++++--------------
src/nano.h | 3 ++-
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/src/nano.c b/src/nano.c
index e66c9839..a2d9e6db 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -843,6 +843,9 @@ void usage(void)
#ifndef NANO_TINY
print_opt("-Z", "--zap", N_("Let Bsp and Del erase a marked region"));
print_opt("-a", "--atblanks", N_("When soft-wrapping, do it at
whitespace"));
+#endif
+#ifdef ENABLE_WRAPPING
+ print_opt("-b", "--breaklonglines", N_("Automatically hard-wrap
overlong lines"));
#endif
print_opt("-c", "--constantshow", N_("Constantly show cursor
position"));
print_opt("-d", "--rebinddelete",
@@ -882,9 +885,6 @@ void usage(void)
print_opt("-u", "--unix", N_("Save a file by default in Unix format"));
#endif
print_opt("-v", "--view", N_("View mode (read-only)"));
-#ifdef ENABLE_WRAPPING
- print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines"));
-#endif
print_opt("-x", "--nohelp", N_("Don't show the two help lines"));
#ifndef NANO_TINY
print_opt("-y", "--afterends", N_("Make Ctrl+Right stop at word ends"));
@@ -1943,10 +1943,6 @@ int main(int argc, char **argv)
bool fill_used = FALSE;
/* Was the fill option used on the command line? */
#endif
-#ifdef ENABLE_WRAPPING
- bool forced_wrapping = FALSE;
- /* Should long lines be automatically hard wrapped? */
-#endif
#ifdef ENABLE_JUSTIFY
int quoterc;
/* Whether the quoting regex was compiled successfully. */
@@ -1974,6 +1970,9 @@ int main(int argc, char **argv)
{"version", 0, NULL, 'V'},
#ifdef ENABLE_COLOR
{"syntax", 1, NULL, 'Y'},
+#endif
+#ifdef ENABLE_WRAPPING
+ {"breaklonglines", 0, NULL, 'b'},
#endif
{"constantshow", 0, NULL, 'c'},
{"rebinddelete", 0, NULL, 'd'},
@@ -2082,7 +2081,7 @@ int main(int argc, char **argv)
while ((optchr =
getopt_long(argc, argv,
-
"ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:Zacdghiklmno:pr:s:tuvwxyz$",
+
"ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:Zabcdghiklmno:pr:s:tuvwxyz$",
long_options, NULL)) != -1) {
switch (optchr) {
#ifndef NANO_TINY
@@ -2194,6 +2193,11 @@ int main(int argc, char **argv)
case 'a':
SET(AT_BLANKS);
break;
+#endif
+#ifdef ENABLE_WRAPPING
+ case 'b':
+ SET(BREAK_LONG_LINES);
+ break;
#endif
case 'c':
SET(CONSTANT_SHOW);
@@ -2247,7 +2251,7 @@ int main(int argc, char **argv)
fill_used = TRUE;
#endif
#ifdef ENABLE_WRAPPING
- forced_wrapping = TRUE;
+ SET(BREAK_LONG_LINES);
#endif
break;
#endif
@@ -2269,10 +2273,7 @@ int main(int argc, char **argv)
break;
#ifdef ENABLE_WRAPPING
case 'w':
- SET(NO_WRAP);
- /* If both --fill and --nowrap are given on the
- * command line, the last given option wins. */
- forced_wrapping = FALSE;
+ UNSET(BREAK_LONG_LINES);
break;
#endif
case 'x':
@@ -2392,8 +2393,10 @@ int main(int argc, char **argv)
#ifdef ENABLE_WRAPPING
/* A --fill on the command line overrides a "set nowrap" in an rcfile.
*/
- if (forced_wrapping)
+ if (ISSET(BREAK_LONG_LINES))
UNSET(NO_WRAP);
+ else
+ SET(NO_WRAP);
#endif
/* If the user wants bold instead of reverse video for hilited text...
*/
diff --git a/src/nano.h b/src/nano.h
index 2a37261b..02290695 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -540,7 +540,8 @@ enum
NO_PAUSES,
AT_BLANKS,
AFTER_ENDS,
- LET_THEM_ZAP
+ LET_THEM_ZAP,
+ BREAK_LONG_LINES
};
/* Flags for the menus in which a given function should be present. */
--
2.19.2
- [Nano-devel] [PATCH 01/15] options: add -b, --breaklonglines, the counterpart of --nowrap,
Benno Schulenberg <=
- [Nano-devel] [PATCH 02/15] options: add -f, --finalnewline, the counterpart of --nonewlines, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 03/15] options: add -j, --jumpyscrolling, the counterpart of --smooth, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 04/15] options: add -e, --emptyline, the counterpart of --morespace, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 05/15] rcfile: add the options that correspond to -b, -f, -j, and -e, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 06/15] options: when a nanorc unsets an old flag, set the corresponding new flag, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 07/15] options: let --fill no longer imply automatic hard-wrapping, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 08/15] docs: stop saying that --fill switches on automatic hard-wrapping, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 09/15] docs: describe the four new options (-b, -f, -j, -e) [*incomplete*], Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 10/15] options: warn when -L, -O, -S, or -w are given, and ignore them, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 11/15] tweaks: switch from referencing NO_WRAP to referencing BREAK_LONG_LINES, Benno Schulenberg, 2019/01/31