Remove the terminal size checks since they've caused so many issues since their introduction

This commit is contained in:
2024-11-03 15:33:08 -07:00
parent c8c7d00517
commit 8d7cb63c7a
2 changed files with 4 additions and 30 deletions
+3 -26
View File
@@ -18,7 +18,7 @@ use clap_complete::generate;
use colored::Colorize;
use crossterm::execute;
use crossterm::terminal::{
disable_raw_mode, enable_raw_mode, size, EnterAlternateScreen, LeaveAlternateScreen,
disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen,
};
use log::error;
use network::NetworkTrait;
@@ -46,9 +46,6 @@ mod network;
mod ui;
mod utils;
static MIN_TERM_WIDTH: u16 = 205;
static MIN_TERM_HEIGHT: u16 = 40;
#[derive(Debug, Parser)]
#[command(
name = crate_name!(),
@@ -75,13 +72,6 @@ struct Cli {
help = "The Managarr configuration file to use"
)]
config: Option<PathBuf>,
#[arg(
long,
global = true,
env = "MANAGARR_DISABLE_TERMINAL_SIZE_CHECKS",
help = "Disable the terminal size checks"
)]
disable_terminal_size_checks: bool,
}
#[tokio::main]
@@ -137,7 +127,7 @@ async fn main() -> Result<()> {
std::thread::spawn(move || {
start_networking(sync_network_rx, &app_nw, cancellation_token, reqwest_client)
});
start_ui(&app, !args.disable_terminal_size_checks).await?;
start_ui(&app).await?;
}
}
@@ -160,20 +150,7 @@ async fn start_networking(
}
}
async fn start_ui(app: &Arc<Mutex<App<'_>>>, check_terminal_size: bool) -> Result<()> {
if check_terminal_size {
let (width, height) = size()?;
if width < MIN_TERM_WIDTH || height < MIN_TERM_HEIGHT {
return Err(anyhow!(
"Terminal too small. Minimum size required: {}x{}; current terminal size: {}x{}",
MIN_TERM_WIDTH,
MIN_TERM_HEIGHT,
width,
height
));
}
}
async fn start_ui(app: &Arc<Mutex<App<'_>>>) -> Result<()> {
let mut stdout = io::stdout();
enable_raw_mode()?;