From 38df8765862c9d1f2cf71c907ec908a581707d2b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 22 Oct 2014 19:24:26 +0100 Subject: [PATCH] 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. --- src/client.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client.cc b/src/client.cc index 92cadaec..3143a0a7 100644 --- a/src/client.cc +++ b/src/client.cc @@ -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") }); }