Set the register incrementally as well during incremental search
Fixes #1054
This commit is contained in:
parent
33eb93b619
commit
25451ac112
|
@ -643,8 +643,7 @@ void regex_prompt(Context& context, String prompt, T func)
|
||||||
context.input_handler().set_prompt_face(get_face("Prompt"));
|
context.input_handler().set_prompt_face(get_face("Prompt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event == PromptEvent::Abort or
|
if (not incsearch and event == PromptEvent::Change)
|
||||||
(event == PromptEvent::Change and (not incsearch or str.empty())))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event == PromptEvent::Validate)
|
if (event == PromptEvent::Validate)
|
||||||
|
@ -678,13 +677,20 @@ void search(Context& context, NormalParams params)
|
||||||
: (direction == Forward ? "search:" : "reverse search:");
|
: (direction == Forward ? "search:" : "reverse search:");
|
||||||
|
|
||||||
const char reg = to_lower(params.reg ? params.reg : '/');
|
const char reg = to_lower(params.reg ? params.reg : '/');
|
||||||
|
auto reg_content = RegisterManager::instance()[reg].values(context);
|
||||||
|
Vector<String> saved_reg{reg_content.begin(), reg_content.end()};
|
||||||
|
int main_index = context.selections().main_index();
|
||||||
int count = params.count;
|
int count = params.count;
|
||||||
regex_prompt(context, prompt.str(),
|
regex_prompt(context, prompt.str(),
|
||||||
[reg, count](Regex ex, PromptEvent event, Context& context) {
|
[reg, count, saved_reg, main_index]
|
||||||
|
(Regex ex, PromptEvent event, Context& context) {
|
||||||
if (ex.empty())
|
if (ex.empty())
|
||||||
ex = Regex{context.main_sel_register_value(reg)};
|
ex = Regex{saved_reg[main_index]};
|
||||||
else if (event == PromptEvent::Validate)
|
if (event == PromptEvent::Abort)
|
||||||
|
RegisterManager::instance()[reg] = saved_reg;
|
||||||
|
else
|
||||||
RegisterManager::instance()[reg] = ex.str();
|
RegisterManager::instance()[reg] = ex.str();
|
||||||
|
|
||||||
if (not ex.empty() and not ex.str().empty())
|
if (not ex.empty() and not ex.str().empty())
|
||||||
{
|
{
|
||||||
bool main_wrapped = false;
|
bool main_wrapped = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user