Fix: Propagate user exit signal to break animation loop
**CRITICAL BUG FIX**: When using -l (loop), the outer loop in main.rs was restarting the animation even after user pressed exit keys. Changes: - render() now returns Result<bool> instead of Result<()> - Returns true when user presses exit key (q/ESC/Ctrl+C) - Returns false when animation completes naturally - main.rs checks return value and breaks loop on user exit This fixes the infinite loop issue where pressing q/ESC/Ctrl+C had no effect when using the -l flag. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -61,8 +61,14 @@ async fn run_piglet(args: PigletCli) -> Result<()> {
|
||||
|
||||
// Run animation
|
||||
loop {
|
||||
animation_engine.run(&mut terminal).await?;
|
||||
let user_exited = animation_engine.run(&mut terminal).await?;
|
||||
|
||||
// If user pressed exit key, stop looping
|
||||
if user_exited {
|
||||
break;
|
||||
}
|
||||
|
||||
// If not looping, stop after one animation
|
||||
if !args.loop_animation {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user