summaryrefslogtreecommitdiff
path: root/src/buffer.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2011-10-05 14:21:24 +0000
committerMaxime Coste <frrrwww@gmail.com>2011-10-05 14:21:24 +0000
commit4ce349fa023998c83292eef4cc2f56a385e95721 (patch)
tree393c0333b1f2b05c00745f6c2f59569651759604 /src/buffer.cc
parentf4743e08bd14c8bfdd4178f35adb3c9216beee4e (diff)
Buffer: modification tracking
Diffstat (limited to 'src/buffer.cc')
-rw-r--r--src/buffer.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/buffer.cc b/src/buffer.cc
index d59977fe..2ee56106 100644
--- a/src/buffer.cc
+++ b/src/buffer.cc
@@ -138,7 +138,7 @@ bool BufferIterator::is_end() const
Buffer::Buffer(const std::string& name, const BufferString& initial_content)
: m_name(name), m_history(1), m_history_cursor(m_history.begin()),
- m_content(initial_content)
+ m_content(initial_content), m_last_save_undo_group(m_history.begin())
{
BufferManager::instance().register_buffer(this);
@@ -350,4 +350,15 @@ void Buffer::delete_window(Window* window)
m_windows.erase(window_it);
}
+bool Buffer::is_modified() const
+{
+ return m_last_save_undo_group != m_history_cursor
+ or not m_current_undo_group.empty();
+}
+
+void Buffer::notify_saved()
+{
+ m_last_save_undo_group = m_history_cursor;
+}
+
}