ui debug in status line
This commit is contained in:
@@ -55,10 +55,22 @@ pub fn render_ui(
|
||||
) {
|
||||
render_background(f, f.area(), theme);
|
||||
|
||||
// --- START DYNAMIC LAYOUT LOGIC ---
|
||||
let mut status_line_height = 1;
|
||||
#[cfg(feature = "ui-debug")]
|
||||
{
|
||||
if let Some(debug_state) = &app_state.debug_state {
|
||||
if debug_state.is_error {
|
||||
status_line_height = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
// --- END DYNAMIC LAYOUT LOGIC ---
|
||||
|
||||
const PALETTE_OPTIONS_HEIGHT_FOR_LAYOUT: u16 = 15;
|
||||
|
||||
let mut bottom_area_constraints: Vec<Constraint> = vec![Constraint::Length(1)];
|
||||
|
||||
let mut bottom_area_constraints: Vec<Constraint> = vec![Constraint::Length(status_line_height)];
|
||||
let command_palette_area_height = if navigation_state.active {
|
||||
1 + PALETTE_OPTIONS_HEIGHT_FOR_LAYOUT
|
||||
} else if event_handler_command_mode_active {
|
||||
|
||||
@@ -24,17 +24,19 @@ use crate::ui::handlers::render::render_ui;
|
||||
use crate::tui::functions::common::login::LoginResult;
|
||||
use crate::tui::functions::common::register::RegisterResult;
|
||||
use crate::ui::handlers::context::DialogPurpose;
|
||||
#[cfg(feature = "ui-debug")]
|
||||
use crate::utils::debug_logger::get_latest_debug_message;
|
||||
use crate::tui::functions::common::login;
|
||||
use crate::tui::functions::common::register;
|
||||
use crate::utils::columns::filter_user_columns;
|
||||
use std::time::Instant;
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use crossterm::cursor::SetCursorStyle;
|
||||
use crossterm::event as crossterm_event;
|
||||
use tracing::{error, info, warn};
|
||||
use tokio::sync::mpsc;
|
||||
use std::time::{Duration, Instant};
|
||||
#[cfg(feature = "ui-debug")]
|
||||
use crate::state::app::state::DebugState;
|
||||
#[cfg(feature = "ui-debug")]
|
||||
use crate::utils::debug_logger::pop_next_debug_message;
|
||||
|
||||
pub async fn run_ui() -> Result<()> {
|
||||
let config = Config::load().context("Failed to load configuration")?;
|
||||
@@ -520,7 +522,20 @@ pub async fn run_ui() -> Result<()> {
|
||||
|
||||
#[cfg(feature = "ui-debug")]
|
||||
{
|
||||
app_state.debug_info = get_latest_debug_message();
|
||||
let can_display_next = match &app_state.debug_state {
|
||||
Some(current) => current.display_start_time.elapsed() >= Duration::from_secs(2),
|
||||
None => true,
|
||||
};
|
||||
|
||||
if can_display_next {
|
||||
if let Some((new_message, is_error)) = pop_next_debug_message() {
|
||||
app_state.debug_state = Some(DebugState {
|
||||
displayed_message: new_message,
|
||||
is_error,
|
||||
display_start_time: Instant::now(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if event_processed || needs_redraw || position_changed {
|
||||
|
||||
Reference in New Issue
Block a user