Tweak history restoring behaviour
This commit is contained in:
parent
e613292568
commit
469818c6f9
|
@ -884,11 +884,9 @@ void search(Context& context, NormalParams params)
|
||||||
regex_prompt<regex_mode>(context, prompt.str(), reg,
|
regex_prompt<regex_mode>(context, prompt.str(), reg,
|
||||||
[reg, count, saved_reg = RegisterManager::instance()[reg].save(context)]
|
[reg, count, saved_reg = RegisterManager::instance()[reg].save(context)]
|
||||||
(const Regex& regex, PromptEvent event, Context& context) {
|
(const Regex& regex, PromptEvent event, Context& context) {
|
||||||
|
RegisterManager::instance()[reg].restore(context, saved_reg);
|
||||||
if (event == PromptEvent::Abort)
|
if (event == PromptEvent::Abort)
|
||||||
{
|
|
||||||
RegisterManager::instance()[reg].restore(context, saved_reg);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
RegisterManager::instance()[reg].set(context, regex.str());
|
RegisterManager::instance()[reg].set(context, regex.str());
|
||||||
|
|
||||||
if (regex.empty() or regex.str().empty())
|
if (regex.empty() or regex.str().empty())
|
||||||
|
@ -970,13 +968,11 @@ void select_regex(Context& context, NormalParams params)
|
||||||
regex_prompt(context, std::move(prompt), reg,
|
regex_prompt(context, std::move(prompt), reg,
|
||||||
[reg, capture, saved_reg = RegisterManager::instance()[reg].save(context)]
|
[reg, capture, saved_reg = RegisterManager::instance()[reg].save(context)]
|
||||||
(Regex ex, PromptEvent event, Context& context) {
|
(Regex ex, PromptEvent event, Context& context) {
|
||||||
if (event == PromptEvent::Abort)
|
RegisterManager::instance()[reg].restore(context, saved_reg);
|
||||||
{
|
if (event == PromptEvent::Abort)
|
||||||
RegisterManager::instance()[reg].restore(context, saved_reg);
|
return;
|
||||||
return;
|
if (not context.history_disabled())
|
||||||
}
|
RegisterManager::instance()[reg].set(context, ex.str());
|
||||||
|
|
||||||
RegisterManager::instance()[reg].set(context, ex.str());
|
|
||||||
|
|
||||||
auto& selections = context.selections();
|
auto& selections = context.selections();
|
||||||
auto& buffer = selections.buffer();
|
auto& buffer = selections.buffer();
|
||||||
|
@ -994,13 +990,11 @@ void split_regex(Context& context, NormalParams params)
|
||||||
regex_prompt(context, std::move(prompt), reg,
|
regex_prompt(context, std::move(prompt), reg,
|
||||||
[reg, capture, saved_reg = RegisterManager::instance()[reg].save(context)]
|
[reg, capture, saved_reg = RegisterManager::instance()[reg].save(context)]
|
||||||
(Regex ex, PromptEvent event, Context& context) {
|
(Regex ex, PromptEvent event, Context& context) {
|
||||||
if (event == PromptEvent::Abort)
|
RegisterManager::instance()[reg].restore(context, saved_reg);
|
||||||
{
|
if (event == PromptEvent::Abort)
|
||||||
RegisterManager::instance()[reg].restore(context, saved_reg);
|
return;
|
||||||
return;
|
if (not context.history_disabled())
|
||||||
}
|
RegisterManager::instance()[reg].set(context, ex.str());
|
||||||
|
|
||||||
RegisterManager::instance()[reg].set(context, ex.str());
|
|
||||||
|
|
||||||
auto& selections = context.selections();
|
auto& selections = context.selections();
|
||||||
auto& buffer = selections.buffer();
|
auto& buffer = selections.buffer();
|
||||||
|
@ -1094,11 +1088,9 @@ void keep(Context& context, NormalParams params)
|
||||||
regex_prompt(context, prompt.str(), reg,
|
regex_prompt(context, prompt.str(), reg,
|
||||||
[reg, saved_reg = RegisterManager::instance()[reg].save(context)]
|
[reg, saved_reg = RegisterManager::instance()[reg].save(context)]
|
||||||
(const Regex& regex, PromptEvent event, Context& context) {
|
(const Regex& regex, PromptEvent event, Context& context) {
|
||||||
|
RegisterManager::instance()[reg].restore(context, saved_reg);
|
||||||
if (event == PromptEvent::Abort)
|
if (event == PromptEvent::Abort)
|
||||||
{
|
|
||||||
RegisterManager::instance()[reg].restore(context, saved_reg);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (not context.history_disabled())
|
if (not context.history_disabled())
|
||||||
RegisterManager::instance()[reg].set(context, regex.str());
|
RegisterManager::instance()[reg].set(context, regex.str());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user