1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-25 21:16:38 +03:00

Preserve window position in regex_prompt

Fixes #271
This commit is contained in:
Maxime Coste 2015-05-18 13:56:13 +01:00
parent 9f502848ad
commit bb7800b1a6

View File

@ -556,6 +556,7 @@ void paste_all(Context& context, NormalParams params)
template<typename T>
void regex_prompt(Context& context, const String prompt, T func)
{
CharCoord position = context.has_window() ? context.window().position() : CharCoord{};
SelectionList selections = context.selections();
context.input_handler().prompt(prompt, "", get_face("Prompt"), complete_nothing,
[=](StringView str, PromptEvent event, Context& context) mutable {
@ -565,6 +566,9 @@ void regex_prompt(Context& context, const String prompt, T func)
context.ui().info_hide();
selections.update();
context.selections_write_only() = selections;
if (context.has_window())
context.window().set_position(position);
context.input_handler().set_prompt_face(get_face("Prompt"));
if (event == PromptEvent::Abort)
return;