diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-07-25 11:15:03 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-07-25 11:15:03 +0100 |
| commit | 1af82e2e24779e863a41fc7bc68bcf5f0f197e8e (patch) | |
| tree | 76368c069764ab274426efff01658fb5d48a718f /src/normal.cc | |
| parent | 6bed46410524b0dc4b39f859dcdc6e86880ca16a (diff) | |
Tweak regex constructor calls
Diffstat (limited to 'src/normal.cc')
| -rw-r--r-- | src/normal.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/normal.cc b/src/normal.cc index 38cfab0e..dea10516 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -592,9 +592,8 @@ void regex_prompt(Context& context, const String prompt, T func) if (event == PromptEvent::Validate) context.push_jump(); - Regex regex = str.empty() ? Regex{} - : Regex{str.begin(), str.end()}; - func(std::move(regex), event, context); + + func(str.empty() ? Regex{} : Regex{str}, event, context); } catch (regex_error& err) { @@ -620,7 +619,7 @@ void search(Context& context, NormalParams) regex_prompt(context, direction == Forward ? "search:" : "reverse search:", [](Regex ex, PromptEvent event, Context& context) { if (ex.empty()) - ex = Regex{context.main_sel_register_value("/").str()}; + ex = Regex{context.main_sel_register_value("/")}; else if (event == PromptEvent::Validate) RegisterManager::instance()['/'] = ex.str(); if (not ex.empty() and not ex.str().empty()) @@ -634,7 +633,7 @@ void search_next(Context& context, NormalParams params) StringView str = context.main_sel_register_value("/"); if (not str.empty()) { - Regex ex{str.begin(), str.end()}; + Regex ex{str}; do { select_next_match<direction, mode>(context.buffer(), context.selections(), ex); } while (--params.count > 0); @@ -679,7 +678,7 @@ void select_regex(Context& context, NormalParams) { regex_prompt(context, "select:", [](Regex ex, PromptEvent event, Context& context) { if (ex.empty()) - ex = Regex{context.main_sel_register_value("/").str()}; + ex = Regex{context.main_sel_register_value("/")}; else if (event == PromptEvent::Validate) RegisterManager::instance()['/'] = ex.str(); if (not ex.empty() and not ex.str().empty()) @@ -691,7 +690,7 @@ void split_regex(Context& context, NormalParams) { regex_prompt(context, "split:", [](Regex ex, PromptEvent event, Context& context) { if (ex.empty()) - ex = Regex{context.main_sel_register_value("/").str()}; + ex = Regex{context.main_sel_register_value("/")}; else if (event == PromptEvent::Validate) RegisterManager::instance()['/'] = ex.str(); if (not ex.empty() and not ex.str().empty()) |
