diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-12-04 21:14:15 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-12-04 21:14:15 +1100 |
| commit | 5c5d881c117d9087899702d7fdc00f3604551633 (patch) | |
| tree | b4390c67f15ba9f04990ab7f067350c6178ff210 /src/buffer.cc | |
| parent | 0b66aa8dda9b92302aae20e9b3e13aaca42ad0d0 (diff) | |
| parent | e1bd076f5e64010578b904ad4bbb25b462517ef3 (diff) | |
Merge remote-tracking branch 'lenormf/reload-buffer-hash'
Diffstat (limited to 'src/buffer.cc')
| -rw-r--r-- | src/buffer.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/buffer.cc b/src/buffer.cc index fbf1c29d..24cf1576 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -78,7 +78,7 @@ Buffer::Buffer(String name, Flags flags, StringView data, m_history{{HistoryId::Invalid}}, m_history_id{HistoryId::First}, m_last_save_history_id{HistoryId::First}, - m_fs_timestamp{fs_timestamp.tv_sec, fs_timestamp.tv_nsec} + m_fs_status{fs_timestamp, data.length(), hash_value(data)} { ParsedLines parsed_lines = parse_lines(data); @@ -122,7 +122,7 @@ void Buffer::on_registered() run_hook_in_own_context(Hook::BufNewFile, m_name); else { - kak_assert(m_fs_timestamp != InvalidTime); + kak_assert(m_fs_status.timestamp != InvalidTime); run_hook_in_own_context(Hook::BufOpenFile, m_name); } } @@ -308,7 +308,7 @@ void Buffer::reload(StringView data, timespec fs_timestamp) apply_options(options(), parsed_lines); m_last_save_history_id = m_history_id; - m_fs_timestamp = fs_timestamp; + m_fs_status = {fs_timestamp, data.length(), hash_value(data)}; } void Buffer::commit_undo_group() @@ -610,7 +610,7 @@ void Buffer::notify_saved() m_flags &= ~Flags::New; m_last_save_history_id = m_history_id; - m_fs_timestamp = get_fs_timestamp(m_name); + m_fs_status.timestamp = get_fs_timestamp(m_name); } BufferCoord Buffer::advance(BufferCoord coord, ByteCount count) const @@ -666,16 +666,16 @@ BufferCoord Buffer::char_prev(BufferCoord coord) const return { coord.line, column }; } -timespec Buffer::fs_timestamp() const +void Buffer::set_fs_status(FsStatus status) { kak_assert(m_flags & Flags::File); - return m_fs_timestamp; + m_fs_status = std::move(status); } -void Buffer::set_fs_timestamp(timespec ts) +const FsStatus& Buffer::fs_status() const { kak_assert(m_flags & Flags::File); - m_fs_timestamp = ts; + return m_fs_status; } void Buffer::on_option_changed(const Option& option) |
