Add "(extend)" to search prompts when we are extending the selection

Fixes #832
This commit is contained in:
Maxime Coste 2016-10-04 13:18:03 +01:00
parent 8a4cf85e22
commit 620fc28ea6

View File

@ -643,9 +643,13 @@ void regex_prompt(Context& context, String prompt, T func)
template<SelectMode mode, Direction direction> template<SelectMode mode, Direction direction>
void search(Context& context, NormalParams params) void search(Context& context, NormalParams params)
{ {
constexpr StringView prompt = mode == SelectMode::Extend ?
(direction == Forward ? "search (extend):" : "reverse search (extend):")
: (direction == Forward ? "search:" : "reverse search:");
const char reg = to_lower(params.reg ? params.reg : '/'); const char reg = to_lower(params.reg ? params.reg : '/');
int count = params.count; int count = params.count;
regex_prompt(context, direction == Forward ? "search:" : "reverse search:", regex_prompt(context, prompt.str(),
[reg, count](Regex ex, PromptEvent event, Context& context) { [reg, count](Regex ex, PromptEvent event, Context& context) {
if (ex.empty()) if (ex.empty())
ex = Regex{context.main_sel_register_value(reg)}; ex = Regex{context.main_sel_register_value(reg)};