summaryrefslogtreecommitdiff
path: root/src/client.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-01-04 11:24:07 +0000
committerMaxime Coste <mawww@kakoune.org>2017-01-04 11:39:51 +0000
commitb3674a2f03b70d231abc3e6aca09d5ed907dfc63 (patch)
tree473ba4837fe5e0a0ca313589190df2485456831b /src/client.cc
parent8f821f0fba48366e0407e5cffece9fa5ffa5a67f (diff)
Add `Modal` InfoStyle used for bufer reload info box
Modal info style wont be replaced by other info boxes. NCursesUI will center that info box. Fixes #1060
Diffstat (limited to 'src/client.cc')
-rw-r--r--src/client.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client.cc b/src/client.cc
index c2904199..0230ff4f 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -287,7 +287,7 @@ void Client::close_buffer_reload_dialog()
{
kak_assert(m_buffer_reload_dialog_opened);
m_buffer_reload_dialog_opened = false;
- info_hide();
+ info_hide(true);
m_input_handler.reset_normal_mode();
}
@@ -311,7 +311,7 @@ void Client::check_if_buffer_needs_reloading()
info_show(format("reload '{}' ?", bufname),
format("'{}' was modified externally\n"
"press <ret> or y to reload, <esc> or n to keep",
- bufname), {}, InfoStyle::Prompt);
+ bufname), {}, InfoStyle::Modal);
m_buffer_reload_dialog_opened = true;
m_input_handler.on_next_key(KeymapMode::None, [this](Key key, Context&){ on_buffer_reload_key(key); });
@@ -360,13 +360,19 @@ void Client::menu_hide()
void Client::info_show(String title, String content, BufferCoord anchor, InfoStyle style)
{
+ if (m_info.style == InfoStyle::Modal) // We already have a modal info opened, do not touch it.
+ return;
+
m_info = Info{ std::move(title), std::move(content), anchor, {}, style };
m_ui_pending |= InfoShow;
m_ui_pending &= ~InfoHide;
}
-void Client::info_hide()
+void Client::info_hide(bool even_modal)
{
+ if (not even_modal and m_info.style == InfoStyle::Modal)
+ return;
+
m_info = Info{};
m_ui_pending |= InfoHide;
m_ui_pending &= ~InfoShow;