Closed xmacex closed 11 months ago
oh, wow, adding command history is no small feat. implem looks fine to me.
also tests!
There is still an Obi-Wan bug [...]
i'm not 100% sure it's the explanation, but doing counting elements of a dynamically populated list w/ #
is considered "unsafe" in lua (length is not updated synchronously w/ additions / deletions).
that's why norns provide tab.count
.
is this bug gets fixed i'd merge this PR right away.
if the user/artist has started writing a command, it will be lost if they browse the input history
this can be tricky & could be dealt with at a later time
one direct implem could be to just use an additional state var to store the last unsubmitted prompt.
but what if the user "forks" the past by editing a prompt from the history? does it become the new "unsubmitted prompt" or do we need to preserve both? we'd have to look at how bash does it & do something similar.
Thank you for insight and feedback, I'll work on it and try tab.count
.
I moved from #
to tab.count
per your suggestion (getting such knowledge is not obvious, thank you for the gift), and I think it was simply my confusion/brainmelt with indexing rather than anything attributable to Lua internals, I think I got the bug now.
well done. didn't take the time to test but i'm confident enough you had this working.
Stellar, thank you. If you or another REPL-afficionado finds issues, please don't hesitate to ping me here on GH, lines, discord or whatever works.
>> print("happy hacking")
Hi,
repl
is such a fun contraption, esp. as a mod to livecode with. I made a little command history, maybe it is useful for merging? Resolves #1Please let me know if it would be better if I implemented this in some other way.
There is still an Obi-Wan bug in
get_next_input
as the first time doesn't register somehow, it seems to be about the offset manipulation... I'll see if I can find it. That's why some of the tests fail too (the tests needprompts
andinput_history
to be temporarily set to be to global, and it needs to be run fromdust/code
to get dependincies).Another think I would not hesitate to call a UI bug is that if the user/artist has started writing a command, it will be lost if they browse the input history... sadface. This draft should be captured somewhere and returned to. Shouldn't be too hard for me to implement.