[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 03/15] options: add -j, --jumpyscrolling, the counte
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] [PATCH 03/15] options: add -j, --jumpyscrolling, the counterpart of --smooth |
Date: |
Thu, 31 Jan 2019 17:49:29 +0100 |
---
src/nano.c | 21 ++++++++++++++++-----
src/nano.h | 3 ++-
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/nano.c b/src/nano.c
index 839afa47..12ab1c07 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -820,9 +820,6 @@ void usage(void)
#endif
if (!ISSET(RESTRICTED))
print_opt("-R", "--restricted", N_("Restricted mode"));
-#ifndef NANO_TINY
- print_opt("-S", "--smooth", N_("Scroll by line instead of
half-screen"));
-#endif
print_opt(_("-T <#cols>"), _("--tabsize=<#cols>"),
N_("Set width of a tab to #cols
columns"));
print_opt("-U", "--quickblank", N_("Do quick statusbar blanking"));
@@ -856,6 +853,9 @@ void usage(void)
print_opt("-h", "--help", N_("Show this help text and exit"));
#ifndef NANO_TINY
print_opt("-i", "--autoindent", N_("Automatically indent new lines"));
+#endif
+ print_opt("-j", "--jumpyscrolling", N_("Scroll per half-screen, not per
line"));
+#ifndef NANO_TINY
print_opt("-k", "--cutfromcursor", N_("Cut from cursor to end of
line"));
#endif
#ifdef ENABLE_LINENUMBERS
@@ -1980,6 +1980,7 @@ int main(int argc, char **argv)
{"showcursor", 0, NULL, 'g'},
#endif
{"help", 0, NULL, 'h'},
+ {"jumpyscrolling", 0, NULL, 'j'},
#ifdef ENABLE_LINENUMBERS
{"linenumbers", 0, NULL, 'l'},
#endif
@@ -2081,7 +2082,7 @@ int main(int argc, char **argv)
while ((optchr =
getopt_long(argc, argv,
-
"ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:Zabcdfghiklmno:pr:s:tuvwxyz$",
+
"ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:Zabcdfghijklmno:pr:s:tuvwxyz$",
long_options, NULL)) != -1) {
switch (optchr) {
#ifndef NANO_TINY
@@ -2157,7 +2158,7 @@ int main(int argc, char **argv)
break;
#ifndef NANO_TINY
case 'S':
- SET(SMOOTH_SCROLL);
+ UNSET(JUMPY_SCROLLING);
break;
#endif
case 'T':
@@ -2218,6 +2219,11 @@ int main(int argc, char **argv)
case 'i':
SET(AUTOINDENT);
break;
+#endif
+ case 'j':
+ SET(JUMPY_SCROLLING);
+ break;
+#ifndef NANO_TINY
case 'k':
SET(CUT_FROM_CURSOR);
break;
@@ -2407,6 +2413,11 @@ int main(int argc, char **argv)
else
SET(NO_NEWLINES);
+ if (ISSET(JUMPY_SCROLLING))
+ UNSET(SMOOTH_SCROLL);
+ else
+ SET(SMOOTH_SCROLL);
+
/* If the user wants bold instead of reverse video for hilited text...
*/
if (ISSET(BOLD_TEXT))
hilite_attribute = A_BOLD;
diff --git a/src/nano.h b/src/nano.h
index 5dc5bd94..5b4afa9d 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -542,7 +542,8 @@ enum
AFTER_ENDS,
LET_THEM_ZAP,
BREAK_LONG_LINES,
- FINAL_NEWLINE
+ FINAL_NEWLINE,
+ JUMPY_SCROLLING
};
/* 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, 2019/01/31
- [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 <=
- [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
- [Nano-devel] [PATCH 12/15] tweaks: switch from referencing NO_NEWLINES to referencing FINAL_NEWLINE, Benno Schulenberg, 2019/01/31