diff --git a/src/window.cc b/src/window.cc index fd3be30a..1b74f341 100644 --- a/src/window.cc +++ b/src/window.cc @@ -66,6 +66,12 @@ void Window::update_display_buffer() m_display_buffer.optimize(); } +void Window::set_position(const DisplayCoord& position) +{ + m_position.line = std::max(0_line, position.line); + m_position.column = std::max(0_char, position.column); +} + void Window::set_dimensions(const DisplayCoord& dimensions) { m_dimensions = dimensions; diff --git a/src/window.hh b/src/window.hh index 79310ddb..866bb3fb 100644 --- a/src/window.hh +++ b/src/window.hh @@ -25,7 +25,7 @@ public: ~Window(); const DisplayCoord& position() const { return m_position; } - void set_position(const DisplayCoord& position) { m_position = position; } + void set_position(const DisplayCoord& position); const DisplayCoord& dimensions() const { return m_dimensions; } void set_dimensions(const DisplayCoord& dimensions);