bottom_panel decoupled
This commit is contained in:
@@ -202,25 +202,37 @@ pub async fn run_ui() -> Result<()> {
|
||||
let event = event_reader.read_event().context("Failed to read terminal event")?;
|
||||
event_processed = true;
|
||||
|
||||
// Decouple Command Line and palettes from canvas:
|
||||
// Only forward keys to Form canvas when:
|
||||
// - not in command mode
|
||||
// - no search/palette active
|
||||
// - focus is inside the canvas
|
||||
if let crossterm_event::Event::Key(key_event) = &event {
|
||||
if let Page::Form(_) = &router.current {
|
||||
if let Some(editor) = app_state.form_editor.as_mut() {
|
||||
match editor.handle_key_event(*key_event) {
|
||||
KeyEventOutcome::Consumed(Some(msg)) => {
|
||||
event_handler.command_message = msg;
|
||||
needs_redraw = true;
|
||||
continue;
|
||||
}
|
||||
KeyEventOutcome::Consumed(None) => {
|
||||
needs_redraw = true;
|
||||
continue;
|
||||
}
|
||||
KeyEventOutcome::Pending => {
|
||||
needs_redraw = true;
|
||||
continue;
|
||||
}
|
||||
KeyEventOutcome::NotMatched => {
|
||||
// fall through to client-level handling
|
||||
let overlay_active = event_handler.command_mode
|
||||
|| app_state.ui.show_search_palette
|
||||
|| event_handler.navigation_state.active;
|
||||
if !overlay_active {
|
||||
if let Page::Form(_) = &router.current {
|
||||
if !app_state.ui.focus_outside_canvas {
|
||||
if let Some(editor) = app_state.form_editor.as_mut() {
|
||||
match editor.handle_key_event(*key_event) {
|
||||
KeyEventOutcome::Consumed(Some(msg)) => {
|
||||
event_handler.command_message = msg;
|
||||
needs_redraw = true;
|
||||
continue;
|
||||
}
|
||||
KeyEventOutcome::Consumed(None) => {
|
||||
needs_redraw = true;
|
||||
continue;
|
||||
}
|
||||
KeyEventOutcome::Pending => {
|
||||
needs_redraw = true;
|
||||
continue;
|
||||
}
|
||||
KeyEventOutcome::NotMatched => {
|
||||
// fall through to client-level handling
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -706,7 +718,15 @@ pub async fn run_ui() -> Result<()> {
|
||||
terminal
|
||||
.show_cursor()
|
||||
.context("Failed to show cursor in Command mode")?;
|
||||
|
||||
// Enforce ReadOnly on any active canvases while in command mode
|
||||
if let Some(editor) = &mut app_state.form_editor {
|
||||
editor.set_mode(canvas::AppMode::ReadOnly);
|
||||
}
|
||||
if let Page::Login(page) = &mut router.current {
|
||||
page.editor.set_mode(canvas::AppMode::ReadOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Workaround for borrow checker
|
||||
|
||||
Reference in New Issue
Block a user