mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-29 22:51:35 +02:00
Changed: Moved check for valid terminal dimensions to before platform init
This commit is contained in:
parent
65c62cef47
commit
01dfd27ec4
25
src/btop.cpp
25
src/btop.cpp
@ -769,6 +769,19 @@ int main(int argc, char **argv) {
|
|||||||
Logger::info("Real tty detected: setting 16 color mode and using tty friendly graph symbols");
|
Logger::info("Real tty detected: setting 16 color mode and using tty friendly graph symbols");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//? Check for valid terminal dimensions
|
||||||
|
{
|
||||||
|
int t_count = 0;
|
||||||
|
while (Term::width <= 0 or Term::width > 10000 or Term::height <= 0 or Term::height > 10000) {
|
||||||
|
sleep_ms(10);
|
||||||
|
Term::refresh();
|
||||||
|
if (++t_count == 100) {
|
||||||
|
Global::exit_error_msg = "Failed to get size of terminal!";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//? Platform dependent init and error check
|
//? Platform dependent init and error check
|
||||||
try {
|
try {
|
||||||
Shared::init();
|
Shared::init();
|
||||||
@ -793,18 +806,6 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//? Calculate sizes of all boxes
|
//? Calculate sizes of all boxes
|
||||||
{
|
|
||||||
int t_count = 0;
|
|
||||||
while (Term::width <= 0 or Term::width > 10000 or Term::height <= 0 or Term::height > 10000) {
|
|
||||||
sleep_ms(10);
|
|
||||||
Term::refresh();
|
|
||||||
if (++t_count == 100) {
|
|
||||||
Global::exit_error_msg = "Failed to get size of terminal!";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Config::presetsValid(Config::getS("presets"));
|
Config::presetsValid(Config::getS("presets"));
|
||||||
if (Global::arg_preset >= 0) {
|
if (Global::arg_preset >= 0) {
|
||||||
Config::current_preset = min(Global::arg_preset, (int)Config::preset_list.size() - 1);
|
Config::current_preset = min(Global::arg_preset, (int)Config::preset_list.size() - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user