cursor hidden if not active

This commit is contained in:
filipriec
2025-04-07 17:16:36 +02:00
parent b061dd3395
commit 7830ebdb3b
2 changed files with 40 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ use crate::services::grpc_client::GrpcClient;
use crate::services::ui_service::UiService;
use crate::tui::terminal::EventReader;
use crate::modes::common::commands::CommandHandler;
use crate::modes::handlers::mode_manager::{AppMode, ModeManager};
use crate::config::colors::themes::Theme;
use crate::config::binds::config::Config;
use crate::ui::handlers::render::render_ui;
@@ -61,6 +62,28 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
);
})?;
// --- Cursor Visibility Logic ---
let current_mode = ModeManager::derive_mode(&app_state, &event_handler);
match current_mode {
AppMode::Edit => {
terminal.show_cursor()?;
}
AppMode::ReadOnly => {
if !app_state.ui.focus_outside_canvas {
terminal.show_cursor()?;
} else {
terminal.hide_cursor()?;
}
}
AppMode::General => {
terminal.hide_cursor()?;
}
AppMode::Command => {
terminal.hide_cursor()?;
}
}
// --- End Cursor Visibility Logic ---
let total_count = app_state.total_count;
let mut current_position = app_state.current_position;
// Store position before event handling to detect navigation