check at startup if terminal window is big enough to display UI properly
This commit is contained in:
@@ -97,6 +97,16 @@ namespace
|
|||||||
bool order_resize = 0;
|
bool order_resize = 0;
|
||||||
size_t header_height, footer_start_y, footer_height;
|
size_t header_height, footer_start_y, footer_height;
|
||||||
|
|
||||||
|
void check_screen_min_size()
|
||||||
|
{
|
||||||
|
if (COLS < 20 || MainHeight < 3)
|
||||||
|
{
|
||||||
|
DestroyScreen();
|
||||||
|
std::cout << "Screen is too small!\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void resize_screen()
|
void resize_screen()
|
||||||
{
|
{
|
||||||
order_resize = 0;
|
order_resize = 0;
|
||||||
@@ -122,12 +132,7 @@ namespace
|
|||||||
RedrawHeader = 1;
|
RedrawHeader = 1;
|
||||||
MainHeight = LINES-(Config.new_design ? 7 : 4);
|
MainHeight = LINES-(Config.new_design ? 7 : 4);
|
||||||
|
|
||||||
if (COLS < 20 || MainHeight < 3)
|
check_screen_min_size();
|
||||||
{
|
|
||||||
DestroyScreen();
|
|
||||||
std::cout << "Screen is too small!\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Config.header_visibility)
|
if (!Config.header_visibility)
|
||||||
MainHeight += 2;
|
MainHeight += 2;
|
||||||
@@ -272,6 +277,7 @@ int main(int argc, char *argv[])
|
|||||||
Config.statusbar_visibility = 0;
|
Config.statusbar_visibility = 0;
|
||||||
|
|
||||||
SetWindowsDimensions(header_height, footer_start_y, footer_height);
|
SetWindowsDimensions(header_height, footer_start_y, footer_height);
|
||||||
|
check_screen_min_size();
|
||||||
|
|
||||||
wHeader = new Window(0, 0, COLS, header_height, "", Config.header_color, brNone);
|
wHeader = new Window(0, 0, COLS, header_height, "", Config.header_color, brNone);
|
||||||
if (Config.header_visibility || Config.new_design)
|
if (Config.header_visibility || Config.new_design)
|
||||||
|
|||||||
Reference in New Issue
Block a user