From 76b7c60afbe93f619d944293e2c0997473dde2af Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 8 Sep 2011 14:30:36 +0000 Subject: Buffer is now responsible for window creation --- src/buffer.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/buffer.cc') diff --git a/src/buffer.cc b/src/buffer.cc index 81ba07e6..1f9503b0 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -316,14 +316,12 @@ void Buffer::append_modification(Modification&& modification) m_current_undo_group.push_back(modification); } -struct window_already_registered {}; - -void Buffer::register_window(Window* window) +Window* Buffer::get_or_create_window() { - if (std::find(m_windows.begin(), m_windows.end(), window) != m_windows.end()) - throw window_already_registered(); + if (m_windows.empty()) + m_windows.push_front(std::unique_ptr(new Window(*this))); - m_windows.push_front(std::unique_ptr(window)); + return m_windows.front().get(); } void Buffer::delete_window(Window* window) -- cgit v1.2.3