diff options
Diffstat (limited to 'src/curses/window.cpp')
-rw-r--r-- | src/curses/window.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/curses/window.cpp b/src/curses/window.cpp index 231e36a6..d3f9efd6 100644 --- a/src/curses/window.cpp +++ b/src/curses/window.cpp @@ -682,13 +682,16 @@ void Window::moveTo(size_t new_x, size_t new_y) void Window::adjustDimensions(size_t width, size_t height) { + // NOTE: when dimensions get small, integer overflow will cause calls to + // `Menu<T>::refresh()` to run for a very long time. + if (m_border) { - width -= 2; - height -= 2; + width -= width >= 2 ? 2 : 0; + height -= height >= 2 ? 2 : 0; } if (!m_title.empty()) - height -= 2; + height -= height >= 2 ? 2 : 0; m_height = height; m_width = width; } |