use find_if instead of a loop

This commit is contained in:
Daniel Micay 2012-11-09 15:24:53 -05:00
parent c85700366e
commit 37ac605880
1 changed files with 4 additions and 6 deletions

View File

@ -429,12 +429,10 @@ void move_first(VteTerminal *vte, select_info *select, F is_match) {
return;
}
for (long i = 0; i < length; i++) {
if (is_match(codepoints[i])) {
vte_terminal_set_cursor_position(vte, i, cursor_row);
auto iter = std::find_if(codepoints, codepoints + length, is_match);
if (iter != codepoints + length) {
vte_terminal_set_cursor_position(vte, iter - codepoints, cursor_row);
update_selection(vte, select);
break;
}
}
g_free(codepoints);