Window: sanitize position in set_position
This commit is contained in:
parent
c947819154
commit
ea17525b2a
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user