nano

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

commit 7f77cad1b4ec8e5fbdb9e87519f4f8cf3e0ba9ab
parent e7511abd8653834cb04fed3c7ba05661040d9fdb
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu, 25 Jun 2020 10:03:56 +0200

tweaks: condense the code a little further, by grouping things better

Diffstat:
Msrc/search.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/search.c b/src/search.c @@ -869,8 +869,8 @@ bool find_a_bracket(bool reverse, const char *bracket_pair) linestruct *line = openfile->current; const char *pointer, *found; - /* Step away from the current bracket, either backwards or forwards. */ if (reverse) { + /* First step away from the current bracket. */ if (openfile->current_x == 0) { line = line->prev; if (line == NULL) @@ -878,11 +878,8 @@ bool find_a_bracket(bool reverse, const char *bracket_pair) pointer = line->data + strlen(line->data); } else pointer = line->data + step_left(line->data, openfile->current_x); - } else - pointer = line->data + step_right(line->data, openfile->current_x); - /* Now seek for any of the two brackets, either backwards or forwards. */ - if (reverse) { + /* Now seek for any of the two brackets we are interested in. */ while (!(found = mbrevstrpbrk(line->data, bracket_pair, pointer))) { line = line->prev; if (line == NULL) @@ -890,6 +887,8 @@ bool find_a_bracket(bool reverse, const char *bracket_pair) pointer = line->data + strlen(line->data); } } else { + pointer = line->data + step_right(line->data, openfile->current_x); + while (!(found = mbstrpbrk(pointer, bracket_pair))) { line = line->next; if (line == NULL)