-
Notifications
You must be signed in to change notification settings - Fork 20
Add auto-next attribute to automatically continue to the next action
#240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4a924a7
e058c82
6fb783d
16e0162
0e6959c
2d609b1
0cc4542
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -60,11 +60,11 @@ let generate window root = | |||||||||
| [] | ||||||||||
| |> List.rev |> List.concat | ||||||||||
| in | ||||||||||
| let rec loop undo entries step categorized_els = | ||||||||||
| let rec loop ~auto_continue undo entries step categorized_els = | ||||||||||
| match categorized_els with | ||||||||||
| | `Title t :: res -> | ||||||||||
| let entries = entry_title t :: entries in | ||||||||||
| loop undo entries step res | ||||||||||
| loop ~auto_continue undo entries step res | ||||||||||
| | `Action a :: res -> | ||||||||||
| if Step.Action_scheduler.is_action a then | ||||||||||
| let* res = | ||||||||||
|
|
@@ -74,13 +74,19 @@ let generate window root = | |||||||||
| let> () = undo in | ||||||||||
| Fut.return res | ||||||||||
| in | ||||||||||
| let step = step + 1 in | ||||||||||
| let entries = entry_action window step :: entries in | ||||||||||
| loop undo entries step categorized_els | ||||||||||
| else loop undo entries step res | ||||||||||
| let step = if auto_continue then step else step + 1 in | ||||||||||
| let entries = | ||||||||||
| if auto_continue then entries | ||||||||||
| else entry_action window step :: entries | ||||||||||
| in | ||||||||||
| let auto_continue = Brr.El.at !!"auto-continue" a |> Option.is_some in | ||||||||||
| loop ~auto_continue undo entries step categorized_els | ||||||||||
|
Comment on lines
+82
to
+83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Advance the recursion with Line 83 re-enters Suggested fix- loop ~auto_continue undo entries step categorized_els
+ loop ~auto_continue undo entries step res📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I’ll keep this behavior in mind for future reviews. 🐇💭 ✏️ Learnings added
🧠 Learnings used |
||||||||||
| else loop ~auto_continue undo entries step res | ||||||||||
| | [] -> Fut.return (undo, List.rev entries) | ||||||||||
| in | ||||||||||
| let* undo, entries = loop (Undoable.return ()) [] 0 categorized_els in | ||||||||||
| let* undo, entries = | ||||||||||
| loop ~auto_continue:false (Undoable.return ()) [] 0 categorized_els | ||||||||||
| in | ||||||||||
| let* (), undo = undo in | ||||||||||
| let+ () = undo () in | ||||||||||
| let els = entry_action window 0 :: entries in | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| a | ||
|
|
||
| {pause} | ||
|
|
||
| b | ||
|
|
||
| {pause auto-continue} | ||
|
|
||
| c | ||
|
|
||
| {pause} | ||
|
|
||
| d |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| Testing auto-next | ||
|
|
||
| $ slipshow compile auto-next.md | ||
|
|
||
| There should be 3 steps: a, then b appears, then c and d appears. | ||
|
|
||
| Also, check the toc! | ||
|
|
||
| $ cp auto-next.html /tmp/ |
Uh oh!
There was an error while loading. Please reload this page.