tweaks: use a slightly faster function where appropriate

Also, correct a call of move_mbright() to use the intended format.
master
Benno Schulenberg 2019-06-09 19:22:24 +02:00
parent 710a600f22
commit ca77254968
2 changed files with 6 additions and 6 deletions

View File

@ -226,7 +226,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
from = line->data + move_mbleft(line->data, from - line->data);
found = strstrwrapper(line->data, needle, from);
} else if (!ISSET(BACKWARDS_SEARCH) && *from != '\0') {
from += move_mbright(from, 0);
from += char_length(from);
found = strstrwrapper(line->data, needle, from);
}
} else
@ -241,7 +241,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
* if it's not, continue looking in the rest of the line. */
if (whole_word_only && !is_separate_word(found - line->data,
found_len, line->data)) {
from = found + move_mbright(found, 0);
from = found + char_length(found);
continue;
}
#endif
@ -955,7 +955,7 @@ void do_find_bracket(void)
wanted_ch = matchbrackets + move_mbleft(matchbrackets,
wanted_ch - matchbrackets);
else
wanted_ch += move_mbright(wanted_ch, 0);
wanted_ch += char_length(wanted_ch);
}
ch_len = char_length(ch);

View File

@ -297,11 +297,11 @@ void handle_indent_action(undo *u, bool undoing, bool add_indent)
}
#endif /* !NANO_TINY */
/* Test whether the string is empty or consists of only blanks. */
/* Return TRUE when the given string is empty or consists of only blanks. */
bool white_string(const char *s)
{
while (*s != '\0' && (is_blank_mbchar(s) || *s == '\r'))
s += move_mbright(s, 0);
s += char_length(s);
return !*s;
}
@ -1413,7 +1413,7 @@ bool do_wrap(void)
return FALSE;
/* Step forward to the character just after the blank. */
wrap_loc += move_mbright(line->data + wrap_loc, 0);
wrap_loc = move_mbright(line->data, wrap_loc);
/* When now at end-of-line, no need to wrap. */
if (line->data[wrap_loc] == '\0')