options: add --markmatch and -^ for activating the select-match behavior
And add, of course, the 'set markmatch' nanorc option.master
parent
caef3128eb
commit
d0bceb1449
|
@ -343,7 +343,8 @@ enum {
|
||||||
BOOKSTYLE,
|
BOOKSTYLE,
|
||||||
STATEFLAGS,
|
STATEFLAGS,
|
||||||
USE_MAGIC,
|
USE_MAGIC,
|
||||||
MINIBAR
|
MINIBAR,
|
||||||
|
MARK_MATCH
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Structure types. */
|
/* Structure types. */
|
||||||
|
|
|
@ -641,6 +641,7 @@ void usage(void)
|
||||||
print_opt("-z", "--suspendable", N_("Enable suspension"));
|
print_opt("-z", "--suspendable", N_("Enable suspension"));
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
print_opt("-%", "--stateflags", N_("Show some states on the title bar"));
|
print_opt("-%", "--stateflags", N_("Show some states on the title bar"));
|
||||||
|
print_opt("-^", "--markmatch", N_("Select the match of a search"));
|
||||||
print_opt("-_", "--minibar", N_("Show bar at bottom with some state info"));
|
print_opt("-_", "--minibar", N_("Show bar at bottom with some state info"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIBMAGIC
|
#ifdef HAVE_LIBMAGIC
|
||||||
|
@ -1759,6 +1760,7 @@ int main(int argc, char **argv)
|
||||||
{"unix", 0, NULL, 'u'},
|
{"unix", 0, NULL, 'u'},
|
||||||
{"afterends", 0, NULL, 'y'},
|
{"afterends", 0, NULL, 'y'},
|
||||||
{"stateflags", 0, NULL, '%'},
|
{"stateflags", 0, NULL, '%'},
|
||||||
|
{"markmatch", 0, NULL, '^'},
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIBMAGIC
|
#ifdef HAVE_LIBMAGIC
|
||||||
{"magic", 0, NULL, '!'},
|
{"magic", 0, NULL, '!'},
|
||||||
|
@ -1813,7 +1815,7 @@ int main(int argc, char **argv)
|
||||||
SET(RESTRICTED);
|
SET(RESTRICTED);
|
||||||
|
|
||||||
while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z"
|
while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z"
|
||||||
"abcdef:ghijklmno:pqr:s:tuvwxyz$_%!", long_options, NULL)) != -1) {
|
"abcdef:ghijklmno:pqr:s:tuvwxyz$%^_!", long_options, NULL)) != -1) {
|
||||||
switch (optchr) {
|
switch (optchr) {
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
case 'A':
|
case 'A':
|
||||||
|
@ -2056,6 +2058,9 @@ int main(int argc, char **argv)
|
||||||
case '%':
|
case '%':
|
||||||
SET(STATEFLAGS);
|
SET(STATEFLAGS);
|
||||||
break;
|
break;
|
||||||
|
case '^':
|
||||||
|
SET(MARK_MATCH);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIBMAGIC
|
#ifdef HAVE_LIBMAGIC
|
||||||
case '!':
|
case '!':
|
||||||
|
|
|
@ -109,6 +109,7 @@ static const rcoption rcopts[] = {
|
||||||
{"indicator", INDICATOR},
|
{"indicator", INDICATOR},
|
||||||
{"jumpyscrolling", JUMPY_SCROLLING},
|
{"jumpyscrolling", JUMPY_SCROLLING},
|
||||||
{"locking", LOCKING},
|
{"locking", LOCKING},
|
||||||
|
{"markmatch", MARK_MATCH},
|
||||||
{"matchbrackets", 0},
|
{"matchbrackets", 0},
|
||||||
{"minibar", MINIBAR},
|
{"minibar", MINIBAR},
|
||||||
{"noconvert", NO_CONVERT},
|
{"noconvert", NO_CONVERT},
|
||||||
|
|
|
@ -323,7 +323,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||||
*match_len = found_len;
|
*match_len = found_len;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (modus == JUSTFIND && (!openfile->mark || openfile->softmark)) {
|
if (modus == JUSTFIND && ISSET(MARK_MATCH) && (!openfile->mark || openfile->softmark)) {
|
||||||
openfile->mark = line;
|
openfile->mark = line;
|
||||||
openfile->mark_x = found_x + found_len;
|
openfile->mark_x = found_x + found_len;
|
||||||
openfile->softmark = TRUE;
|
openfile->softmark = TRUE;
|
||||||
|
|
Loading…
Reference in New Issue