minttea icon indicating copy to clipboard operation
minttea copied to clipboard

draft: Implemented some wrapping examples using shape the term package

Open jmcavanillas opened this issue 10 months ago • 5 comments

Opening this PR to include wrap and wrap by word showcases using https://github.com/jmcavanillas/shape-the-term

The examples are functional and ready for review but there are a couple of issues to address,

To be completed / addressed before merging:

  • [ ] If I do not set fps to a low value my computes just go BRRRRRR! :fire: and input starts to lag (actually maybe there is no solution yet for this as I think we will need a state diffing solution or similar)
  • [ ] I have to pin the shape-the-term repo to main, I would like to include it as pin-depends but I have no idea yet
  • [ ] Add VHS gifs
  • [ ] BONUS: Update readme example for Spices, there is no render function anymore

jmcavanillas avatar Apr 15 '24 20:04 jmcavanillas

Thanks for the PR @jmcavanillas! Re: the CPU usage, are you testing this on the latest Minttea with Riot 0.0.9?

leostera avatar Apr 16 '24 09:04 leostera

I am testing with minttea main branch and riot 0.0.8, I tried to update to riot 0.0.9 but dune did not want to build due to a warning with receive function parameters I think. I will try again this afternoon and share the exact error I get when building

jmcavanillas avatar Apr 16 '24 10:04 jmcavanillas

Yeah I think minttea need an update to work with riot 0.0.9, I see you have a branch with some updates about it

~/Projects/minttea$ dune build --profile release
File "minttea/io_loop.ml", line 49, characters 10-20:
49 |   let _ = receive () in
               ^^^^^^^^^^
Warning 5 [ignored-partial-application]: this function application is partial,
maybe some arguments are missing.
File "minttea/renderer.ml", line 31, characters 4-12:
31 |   | Shutdown ->
         ^^^^^^^^
Error: This pattern should not be a constructor, the expected type is
       selector:(Riot.Message.t -> [ `select of 'a | `skip ]) -> 'a
File "minttea/program.ml", line 13, characters 6-15:
13 |     | Timer ref -> Event.Timer ref
           ^^^^^^^^^
Error: This pattern should not be a constructor, the expected type is
       selector:(Riot.Message.t -> [ `select of 'a | `skip ]) -> 'a
File "minttea/io_loop.ml", line 49, characters 10-20:
49 |   let _ = receive () in
               ^^^^^^^^^^
Warning 5 [ignored-partial-application]: this function application is partial,
maybe some arguments are missing.

jmcavanillas avatar Apr 17 '24 17:04 jmcavanillas

I have merged your updates to minttea and now they usually work better at 60 fps and the CPU fans behave better but sometimes they do not.

Now there is a new issue, when I enter some text in the input and then press intro to finish the program, sometimes it finishes as expected, but other times it just print final output but does not finish, it gets stuck, and the fans go BRRR! :fire: again.

A) Steps to reproduce

  1. build the examples
  2. dune exec examples/text-wrapping/main.exe or dune exec examples/word-wrapping/main.exe
  3. Enter random text, I did it fast as it was just random letters and spaces
  4. Press intro
  5. (Sometimes it works, others it just gets stuck before exit and you have to Ctrl + C)

B) I run the example multiple times at 60 fps without rebuilding and some runs present heavy input lag.

Setting fps to a lower value seems to reduce the lag cases but I still experience issue A at 2 fps

OS: Fedora Linux 39 (Workstation Edition) x86_64
Kernel: 6.8.5-201.fc39.x86_64 
Uptime: 1 hour, 9 mins 
DE: GNOME 45.5 
CPU: AMD Ryzen 7 7700X (16) @ 5.573GHz 
Memory: 4942MiB / 31228MiB 

jmcavanillas avatar Apr 17 '24 18:04 jmcavanillas

Hang Video: (The program exits because I press Ctrl +C)

2024-04-17 20-35-30.webm

I have another larger video showing lag and much higher CPU usage but I cannot upload it here

jmcavanillas avatar Apr 17 '24 18:04 jmcavanillas