Window: sanitize position in set_position

This commit is contained in:
Maxime Coste 2012-10-31 14:28:47 +01:00
parent c947819154
commit ea17525b2a
2 changed files with 7 additions and 1 deletions

View File

@ -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;

View File

@ -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);