summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-03-24 19:31:40 +0000
committerMaxime Coste <frrrwww@gmail.com>2014-03-24 19:31:40 +0000
commita4070d9037ba442b34688241a97a3cd5ba0db2d3 (patch)
tree4911c1688ccdec181449473a7fc43f334b49a897 /src
parent7ec56962586fe7877199718669b7c52860e7b8ec (diff)
Use an info box to prompt for reloading of modified files
Diffstat (limited to 'src')
-rw-r--r--src/client.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/client.cc b/src/client.cc
index 1fcd5e3e..e6527944 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -114,15 +114,19 @@ void Client::check_buffer_fs_timestamp()
return;
if (reload == Ask)
{
- print_status({"'" + buffer.display_name() + "' was modified externally, press r or y to reload, k or n to keep", get_color("Prompt")});
+ DisplayCoord pos = context().window().dimensions();
+ pos.column -= 1;
+ m_ui->info_show("reload '" + buffer.display_name() + "' ?",
+ "'" + buffer.display_name() + "' was modified externally\n"
+ "press r or y to reload, k or n to keep",
+ pos, get_color("Information"), MenuStyle::Prompt);
+
m_input_handler.on_next_key([this, ts, filename](Key key, Context& context) {
Buffer* buf = BufferManager::instance().get_buffer_ifp(filename);
+ m_ui->info_hide();
// buffer got deleted while waiting for the key, do nothing
if (not buf)
- {
- print_status({});
return;
- }
if (key == 'r' or key == 'y')
reload_buffer(context, filename);
if (key == 'k' or key == 'n')
@@ -131,7 +135,10 @@ void Client::check_buffer_fs_timestamp()
print_status({"'" + buf->display_name() + "' kept", get_color("Information") });
}
else
+ {
+ print_status({"'" + key_to_str(key) + "' is not a valid choice", get_color("Error")});
check_buffer_fs_timestamp();
+ }
});
}
else