Reread file timestamp at the moment the user choose to keep

The previous behaviour ended up asking twice for reloading if the
buffer was modified again after Kakoune had detected the first
change.
This commit is contained in:
Maxime Coste 2014-10-22 19:24:26 +01:00
parent 7f23d4b756
commit 38df876586

View File

@ -147,7 +147,7 @@ void Client::check_buffer_fs_timestamp()
pos, get_face("Information"), MenuStyle::Prompt);
m_input_handler.on_next_key(KeymapMode::None,
[this, filename, ts](Key key, Context& context) {
[this, 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
@ -157,7 +157,8 @@ void Client::check_buffer_fs_timestamp()
reload_buffer(context, filename);
else if (key == 'k' or key == 'n')
{
buf->set_fs_timestamp(ts);
// reread timestamp in case the file was modified again
buf->set_fs_timestamp(get_fs_timestamp(filename));
print_status({ "'" + buf->display_name() + "' kept",
get_face("Information") });
}