summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actions.cpp14
-rw-r--r--src/curses/window.cpp9
2 files changed, 6 insertions, 17 deletions
diff --git a/src/actions.cpp b/src/actions.cpp
index 70fb97ff..9bcb15ec 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -124,18 +124,6 @@ size_t HeaderHeight;
size_t FooterHeight;
size_t FooterStartY;
-void validateScreenSize()
-{
- using Global::MainHeight;
-
- if (COLS < 30 || MainHeight < 5)
- {
- NC::destroyScreen();
- std::cout << "Screen is too small to handle ncmpcpp correctly\n";
- exit(1);
- }
-}
-
void initializeScreens()
{
myHelp = new Help;
@@ -221,8 +209,6 @@ void resizeScreen(bool reload_main_window)
MainHeight = std::max(LINES-(Config.design == Design::Alternative ? 7 : 4), 0);
- validateScreenSize();
-
if (!Config.header_visibility)
MainHeight += 2;
if (!Config.statusbar_visibility)
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;
}