don't actually need lambda's here

This commit is contained in:
Simon Gomizelj 2013-04-11 21:10:51 -04:00
parent 56ac2acf44
commit 0b66678c01
1 changed files with 3 additions and 12 deletions

View File

@ -922,25 +922,16 @@ GtkTreeModel *create_completion_model(VteTerminal *vte) {
} }
void search(VteTerminal *vte, const char *pattern, bool reverse) { void search(VteTerminal *vte, const char *pattern, bool reverse) {
std::function<int ()> terminal_search; auto terminal_search = reverse ? vte_terminal_search_find_previous : vte_terminal_search_find_next;
if (!reverse) {
terminal_search = [vte]() {
return vte_terminal_search_find_next(vte);
};
} else {
terminal_search = [vte]() {
return vte_terminal_search_find_previous(vte);
};
};
GRegex *regex = vte_terminal_search_get_gregex(vte); GRegex *regex = vte_terminal_search_get_gregex(vte);
if (regex) g_regex_unref(regex); if (regex) g_regex_unref(regex);
regex = g_regex_new(pattern, (GRegexCompileFlags)0, (GRegexMatchFlags)0, nullptr); regex = g_regex_new(pattern, (GRegexCompileFlags)0, (GRegexMatchFlags)0, nullptr);
vte_terminal_search_set_gregex(vte, regex); vte_terminal_search_set_gregex(vte, regex);
if (!terminal_search()) { if (!terminal_search(vte)) {
vte_terminal_select_none(vte); vte_terminal_select_none(vte);
terminal_search(); terminal_search(vte);
} }
vte_terminal_copy_primary(vte); vte_terminal_copy_primary(vte);