1
1

options: add -j, --jumpyscrolling, the counterpart of --smooth

Этот коммит содержится в:
Benno Schulenberg 2019-01-25 15:44:52 +01:00
родитель 5dbd9c0043
Коммит 401e43969c
2 изменённых файлов: 18 добавлений и 3 удалений

Просмотреть файл

@ -858,6 +858,9 @@ void usage(void)
print_opt("-h", "--help", N_("Show this help text and exit")); print_opt("-h", "--help", N_("Show this help text and exit"));
#ifndef NANO_TINY #ifndef NANO_TINY
print_opt("-i", "--autoindent", N_("Automatically indent new lines")); 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")); print_opt("-k", "--cutfromcursor", N_("Cut from cursor to end of line"));
#endif #endif
#ifdef ENABLE_LINENUMBERS #ifdef ENABLE_LINENUMBERS
@ -1985,6 +1988,7 @@ int main(int argc, char **argv)
{"showcursor", 0, NULL, 'g'}, {"showcursor", 0, NULL, 'g'},
#endif #endif
{"help", 0, NULL, 'h'}, {"help", 0, NULL, 'h'},
{"jumpyscrolling", 0, NULL, 'j'},
#ifdef ENABLE_LINENUMBERS #ifdef ENABLE_LINENUMBERS
{"linenumbers", 0, NULL, 'l'}, {"linenumbers", 0, NULL, 'l'},
#endif #endif
@ -2086,7 +2090,7 @@ int main(int argc, char **argv)
while ((optchr = while ((optchr =
getopt_long(argc, argv, 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) { long_options, NULL)) != -1) {
switch (optchr) { switch (optchr) {
#ifndef NANO_TINY #ifndef NANO_TINY
@ -2162,7 +2166,7 @@ int main(int argc, char **argv)
break; break;
#ifndef NANO_TINY #ifndef NANO_TINY
case 'S': case 'S':
SET(SMOOTH_SCROLL); UNSET(JUMPY_SCROLLING);
break; break;
#endif #endif
case 'T': case 'T':
@ -2223,6 +2227,11 @@ int main(int argc, char **argv)
case 'i': case 'i':
SET(AUTOINDENT); SET(AUTOINDENT);
break; break;
#endif
case 'j':
SET(JUMPY_SCROLLING);
break;
#ifndef NANO_TINY
case 'k': case 'k':
SET(CUT_FROM_CURSOR); SET(CUT_FROM_CURSOR);
break; break;
@ -2412,6 +2421,11 @@ int main(int argc, char **argv)
else else
SET(NO_NEWLINES); 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 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;

Просмотреть файл

@ -542,7 +542,8 @@ enum
AFTER_ENDS, AFTER_ENDS,
LET_THEM_ZAP, LET_THEM_ZAP,
BREAK_LONG_LINES, BREAK_LONG_LINES,
FINAL_NEWLINE FINAL_NEWLINE,
JUMPY_SCROLLING
}; };
/* Flags for the menus in which a given function should be present. */ /* Flags for the menus in which a given function should be present. */