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; return;
} }
for (long i = 0; i < length; i++) { auto iter = std::find_if(codepoints, codepoints + length, is_match);
if (is_match(codepoints[i])) { if (iter != codepoints + length) {
vte_terminal_set_cursor_position(vte, i, cursor_row); vte_terminal_set_cursor_position(vte, iter - codepoints, cursor_row);
update_selection(vte, select); update_selection(vte, select);
break;
}
} }
g_free(codepoints); g_free(codepoints);