nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit d0bceb14493ea099d37610a689ca8bdc8992e659
parent caef3128ebcb252b96ea97c2f0b8176cf8a809a2
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat, 19 Dec 2020 13:44:42 +0100

options: add --markmatch and -^ for activating the select-match behavior

And add, of course, the 'set markmatch' nanorc option.

Diffstat:
Msrc/definitions.h | 3++-
Msrc/nano.c | 7++++++-
Msrc/rcfile.c | 1+
Msrc/search.c | 2+-
4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/definitions.h b/src/definitions.h @@ -343,7 +343,8 @@ enum { BOOKSTYLE, STATEFLAGS, USE_MAGIC, - MINIBAR + MINIBAR, + MARK_MATCH }; /* Structure types. */ diff --git a/src/nano.c b/src/nano.c @@ -641,6 +641,7 @@ void usage(void) print_opt("-z", "--suspendable", N_("Enable suspension")); #ifndef NANO_TINY 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")); #endif #ifdef HAVE_LIBMAGIC @@ -1759,6 +1760,7 @@ int main(int argc, char **argv) {"unix", 0, NULL, 'u'}, {"afterends", 0, NULL, 'y'}, {"stateflags", 0, NULL, '%'}, + {"markmatch", 0, NULL, '^'}, #endif #ifdef HAVE_LIBMAGIC {"magic", 0, NULL, '!'}, @@ -1813,7 +1815,7 @@ int main(int argc, char **argv) SET(RESTRICTED); 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) { #ifndef NANO_TINY case 'A': @@ -2056,6 +2058,9 @@ int main(int argc, char **argv) case '%': SET(STATEFLAGS); break; + case '^': + SET(MARK_MATCH); + break; #endif #ifdef HAVE_LIBMAGIC case '!': diff --git a/src/rcfile.c b/src/rcfile.c @@ -109,6 +109,7 @@ static const rcoption rcopts[] = { {"indicator", INDICATOR}, {"jumpyscrolling", JUMPY_SCROLLING}, {"locking", LOCKING}, + {"markmatch", MARK_MATCH}, {"matchbrackets", 0}, {"minibar", MINIBAR}, {"noconvert", NO_CONVERT}, diff --git a/src/search.c b/src/search.c @@ -323,7 +323,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus, *match_len = found_len; #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_x = found_x + found_len; openfile->softmark = TRUE;