Feat: documentation, UI/UX
This commit is contained in:
@@ -30,6 +30,7 @@ pub(super) fn handle_help_page(ctx: &mut InputContext, key: KeyEvent) -> InputRe
|
||||
}
|
||||
KeyCode::Esc if ctx.app.ui.help_focused_block.is_some() => {
|
||||
ctx.app.ui.help_focused_block = None;
|
||||
ctx.app.ui.help_block_output = None;
|
||||
}
|
||||
KeyCode::Tab => ctx.dispatch(AppCommand::HelpToggleFocus),
|
||||
KeyCode::Left if ctx.app.ui.help_focus == HelpFocus::Topics => {
|
||||
@@ -106,6 +107,7 @@ fn navigate_code_block(ctx: &mut InputContext, forward: bool) {
|
||||
let scroll_to = parsed.code_blocks[next].start_line.saturating_sub(2);
|
||||
drop(cache);
|
||||
ctx.app.ui.help_focused_block = Some(next);
|
||||
ctx.app.ui.help_block_output = None;
|
||||
*ctx.app.ui.help_scroll_mut() = scroll_to;
|
||||
}
|
||||
|
||||
@@ -115,7 +117,7 @@ fn execute_focused_block(ctx: &mut InputContext) {
|
||||
let Some(parsed) = cache[ctx.app.ui.help_topic].as_ref() else {
|
||||
return;
|
||||
};
|
||||
let idx = ctx.app.ui.help_focused_block.expect("block focused in code nav");
|
||||
let idx = ctx.app.ui.help_focused_block.unwrap();
|
||||
let Some(block) = parsed.code_blocks.get(idx) else {
|
||||
return;
|
||||
};
|
||||
@@ -126,11 +128,17 @@ fn execute_focused_block(ctx: &mut InputContext) {
|
||||
.map(|l| l.split(" => ").next().unwrap_or(l))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
let topic = ctx.app.ui.help_topic;
|
||||
let block_idx = ctx.app.ui.help_focused_block.expect("block focused in code nav");
|
||||
match ctx
|
||||
.app
|
||||
.execute_script_oneshot(&cleaned, ctx.link, ctx.audio_tx)
|
||||
{
|
||||
Ok(()) => ctx.app.ui.flash("Executed", 100, FlashKind::Info),
|
||||
Ok(Some(output)) => {
|
||||
ctx.app.ui.flash(&output, 200, FlashKind::Info);
|
||||
ctx.app.ui.help_block_output = Some((topic, block_idx, output));
|
||||
}
|
||||
Ok(None) => ctx.app.ui.flash("Executed", 100, FlashKind::Info),
|
||||
Err(e) => ctx
|
||||
.app
|
||||
.ui
|
||||
@@ -153,6 +161,7 @@ fn collapse_help_section(ctx: &mut InputContext) {
|
||||
}
|
||||
ctx.app.ui.help_on_section = Some(section);
|
||||
ctx.app.ui.help_focused_block = None;
|
||||
ctx.app.ui.help_block_output = None;
|
||||
}
|
||||
|
||||
fn expand_help_section(ctx: &mut InputContext) {
|
||||
@@ -167,6 +176,7 @@ fn expand_help_section(ctx: &mut InputContext) {
|
||||
ctx.app.ui.help_topic = first;
|
||||
}
|
||||
ctx.app.ui.help_focused_block = None;
|
||||
ctx.app.ui.help_block_output = None;
|
||||
}
|
||||
|
||||
fn collapse_dict_section(ctx: &mut InputContext) {
|
||||
|
||||
@@ -121,7 +121,7 @@ pub(super) fn handle_main_page(ctx: &mut InputContext, key: KeyEvent, ctrl: bool
|
||||
.app
|
||||
.execute_script_oneshot(script, ctx.link, ctx.audio_tx)
|
||||
{
|
||||
Ok(()) => ctx
|
||||
Ok(_) => ctx
|
||||
.app
|
||||
.ui
|
||||
.flash("Executed", 100, crate::state::FlashKind::Info),
|
||||
|
||||
@@ -158,6 +158,12 @@ fn handle_normal_input(ctx: &mut InputContext, key: KeyEvent) -> InputResult {
|
||||
}
|
||||
}
|
||||
|
||||
// F11 — hidden Script page (no minimap flash)
|
||||
if key.code == KeyCode::F(11) {
|
||||
ctx.dispatch(AppCommand::GoToPage(Page::Script));
|
||||
return InputResult::Continue;
|
||||
}
|
||||
|
||||
if let Some(page) = match key.code {
|
||||
KeyCode::F(1) => Some(Page::Dict),
|
||||
KeyCode::F(2) => Some(Page::Patterns),
|
||||
@@ -165,7 +171,6 @@ fn handle_normal_input(ctx: &mut InputContext, key: KeyEvent) -> InputResult {
|
||||
KeyCode::F(4) => Some(Page::Help),
|
||||
KeyCode::F(5) => Some(Page::Main),
|
||||
KeyCode::F(6) => Some(Page::Engine),
|
||||
KeyCode::F(7) => Some(Page::Script),
|
||||
_ => None,
|
||||
} {
|
||||
ctx.app.ui.minimap = MinimapMode::Timed(Instant::now() + Duration::from_millis(1000));
|
||||
|
||||
@@ -357,16 +357,13 @@ pub(super) fn handle_modal_input(ctx: &mut InputContext, key: KeyEvent) -> Input
|
||||
editor.search_prev();
|
||||
}
|
||||
}
|
||||
KeyCode::Char('s') if ctrl => {
|
||||
ctx.dispatch(AppCommand::ToggleEditorStack);
|
||||
}
|
||||
KeyCode::Char('r') if ctrl => {
|
||||
let script = ctx.app.editor_ctx.editor.lines().join("\n");
|
||||
match ctx
|
||||
.app
|
||||
.execute_script_oneshot(&script, ctx.link, ctx.audio_tx)
|
||||
{
|
||||
Ok(()) => ctx
|
||||
Ok(_) => ctx
|
||||
.app
|
||||
.ui
|
||||
.flash("Executed", 100, crate::state::FlashKind::Info),
|
||||
@@ -413,9 +410,6 @@ pub(super) fn handle_modal_input(ctx: &mut InputContext, key: KeyEvent) -> Input
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.app.editor_ctx.show_stack {
|
||||
crate::services::stack_preview::update_cache(&ctx.app.editor_ctx);
|
||||
}
|
||||
}
|
||||
Modal::PatternProps {
|
||||
bank,
|
||||
|
||||
@@ -26,9 +26,6 @@ fn handle_focused(ctx: &mut InputContext, key: KeyEvent) -> InputResult {
|
||||
ctx.dispatch(AppCommand::ScriptSave);
|
||||
ctx.dispatch(AppCommand::ScriptEvaluate);
|
||||
}
|
||||
(true, KeyCode::Char('s')) => {
|
||||
ctx.dispatch(AppCommand::ToggleScriptStack);
|
||||
}
|
||||
_ => {
|
||||
ctx.app.script_editor.editor.input(key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user