tweaks: rename another variable, to be more descriptive
parent
25a5fb8231
commit
601973ddc2
15
src/search.c
15
src/search.c
|
@ -936,7 +936,7 @@ void do_find_bracket(void)
|
||||||
/* The pair of characters in ch and wanted_ch. */
|
/* The pair of characters in ch and wanted_ch. */
|
||||||
size_t halfway = 0;
|
size_t halfway = 0;
|
||||||
/* The index in matchbrackets where the closing brackets start. */
|
/* The index in matchbrackets where the closing brackets start. */
|
||||||
size_t mbmatchhalf;
|
size_t charcount = mbstrlen(matchbrackets) / 2;
|
||||||
/* Half the number of characters in matchbrackets. */
|
/* Half the number of characters in matchbrackets. */
|
||||||
size_t balance = 1;
|
size_t balance = 1;
|
||||||
/* The initial bracket count. */
|
/* The initial bracket count. */
|
||||||
|
@ -956,23 +956,18 @@ void do_find_bracket(void)
|
||||||
current_save = openfile->current;
|
current_save = openfile->current;
|
||||||
current_x_save = openfile->current_x;
|
current_x_save = openfile->current_x;
|
||||||
|
|
||||||
mbmatchhalf = mbstrlen(matchbrackets) / 2;
|
|
||||||
|
|
||||||
/* Find the halfway point in matchbrackets, where the closing ones start. */
|
/* Find the halfway point in matchbrackets, where the closing ones start. */
|
||||||
for (size_t i = 0; i < mbmatchhalf; i++)
|
for (size_t i = 0; i < charcount; i++)
|
||||||
halfway += parse_mbchar(matchbrackets + halfway, NULL, NULL);
|
halfway += parse_mbchar(matchbrackets + halfway, NULL, NULL);
|
||||||
|
|
||||||
/* When on a closing bracket, we have to search backwards for a matching
|
/* When on a closing bracket, we have to search backwards for a matching
|
||||||
* opening bracket; otherwise, forward for a matching closing bracket. */
|
* opening bracket; otherwise, forward for a matching closing bracket. */
|
||||||
reverse = (ch >= (matchbrackets + halfway));
|
reverse = (ch >= (matchbrackets + halfway));
|
||||||
|
|
||||||
/* If we're on an opening bracket, set wanted_ch to the character
|
/* Step half the number of total characters either backwards or forwards
|
||||||
* that's mbmatchhalf characters after ch. If we're on a closing
|
* through matchbrackets to find the wanted complementary bracket. */
|
||||||
* bracket, set wanted_ch to the character that's mbmatchhalf
|
|
||||||
* characters before ch. */
|
|
||||||
wanted_ch = ch;
|
wanted_ch = ch;
|
||||||
|
while (charcount-- > 0) {
|
||||||
while (mbmatchhalf-- > 0) {
|
|
||||||
if (reverse)
|
if (reverse)
|
||||||
wanted_ch = matchbrackets + move_mbleft(matchbrackets,
|
wanted_ch = matchbrackets + move_mbleft(matchbrackets,
|
||||||
wanted_ch - matchbrackets);
|
wanted_ch - matchbrackets);
|
||||||
|
|
Loading…
Reference in New Issue