From 44281c8fedfd923b951580cf42bc768991eae502 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 17 Oct 2013 18:47:09 +0100 Subject: More robust Buffer filesystem timestamp handling --- src/buffer.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/buffer.cc') diff --git a/src/buffer.cc b/src/buffer.cc index 0470884d..9106d595 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -12,11 +12,13 @@ namespace Kakoune { -Buffer::Buffer(String name, Flags flags, std::vector lines) +Buffer::Buffer(String name, Flags flags, std::vector lines, + time_t fs_timestamp) : m_name(std::move(name)), m_flags(flags | Flags::NoUndo), m_history(), m_history_cursor(m_history.begin()), m_last_save_undo_index(0), m_timestamp(0), + m_fs_timestamp(fs_timestamp), m_hooks(GlobalHooks::instance()), m_options(GlobalOptions::instance()) { @@ -44,7 +46,10 @@ Buffer::Buffer(String name, Flags flags, std::vector lines) if (flags & Flags::New) m_hooks.run_hook("BufNew", m_name, context); else + { + kak_assert(m_fs_timestamp != InvalidTime); m_hooks.run_hook("BufOpen", m_name, context); + } } m_hooks.run_hook("BufCreate", m_name, context); @@ -607,6 +612,7 @@ void Buffer::notify_saved() ++m_timestamp; m_last_save_undo_index = history_cursor_index; } + m_fs_timestamp = get_fs_timestamp(m_name); } BufferCoord Buffer::advance(BufferCoord coord, ByteCount count) const -- cgit v1.2.3