Don't modify prompt history when validating empty input

Fixes #5076
This commit is contained in:
Johannes Altmanninger 2024-01-13 16:52:55 +01:00
parent 9d8c9777a4
commit 20b0eadfc8
5 changed files with 12 additions and 1 deletions

View File

@ -866,6 +866,7 @@ void regex_prompt(Context& context, String prompt, char reg, T func)
RegisterManager::instance()[reg].set(context, str.str()); RegisterManager::instance()[reg].set(context, str.str());
break; break;
case PromptEvent::Validate: case PromptEvent::Validate:
if (not str.empty())
RegisterManager::instance()[reg].set(context, str.str()); RegisterManager::instance()[reg].set(context, str.str());
context.push_jump(); context.push_jump();
break; break;

View File

@ -0,0 +1 @@
abab

View File

@ -0,0 +1,7 @@
ui_out -ignore 7
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "xsa<ret>" ] }'
ui_out -ignore 6
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "xs<ret>" ] }'
ui_out -ignore 5
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "xs<ret>" ] }'
ui_out -ignore 5