moving the state from general to each page owning its own state of button or canvas focus
This commit is contained in:
@@ -227,8 +227,17 @@ pub async fn run_ui() -> Result<()> {
|
||||
|| app_state.ui.show_search_palette
|
||||
|| event_handler.navigation_state.active;
|
||||
if !overlay_active {
|
||||
if let Page::Form(path) = &router.current {
|
||||
if !app_state.ui.focus_outside_canvas {
|
||||
let inside_canvas = match &router.current {
|
||||
Page::Form(_) => true,
|
||||
Page::Login(state) => !state.focus_outside_canvas,
|
||||
Page::Register(state) => !state.focus_outside_canvas,
|
||||
Page::AddTable(state) => !state.focus_outside_canvas,
|
||||
Page::AddLogic(state) => !state.focus_outside_canvas,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
if inside_canvas {
|
||||
if let Page::Form(path) = &router.current {
|
||||
if let Some(editor) = app_state.editor_for_path(path) {
|
||||
match editor.handle_key_event(*key_event) {
|
||||
KeyEventOutcome::Consumed(Some(msg)) => {
|
||||
@@ -633,7 +642,15 @@ pub async fn run_ui() -> Result<()> {
|
||||
|
||||
match current_mode {
|
||||
AppMode::General => {
|
||||
if app_state.ui.focus_outside_canvas {
|
||||
let outside_canvas = match &router.current {
|
||||
Page::Login(state) => state.focus_outside_canvas,
|
||||
Page::Register(state) => state.focus_outside_canvas,
|
||||
Page::AddTable(state) => state.focus_outside_canvas,
|
||||
Page::AddLogic(state) => state.focus_outside_canvas,
|
||||
_ => false, // Form and Admin don’t use this flag
|
||||
};
|
||||
|
||||
if outside_canvas {
|
||||
// Outside canvas → app decides
|
||||
terminal.set_cursor_style(SetCursorStyle::SteadyUnderScore)?;
|
||||
terminal.show_cursor()?;
|
||||
|
||||
Reference in New Issue
Block a user