Hello @Julian, welcome to the forum and thank you for your question.
You will notice it is not easy to view the code snippet you have posted. If you could please edit your post to follow the guidance provided in:
This way your code will look like:
#let cursor = state(“cursor”, 0.1em)
...
It is easier to copy and paste and to read all along.
Could you please ensure that the code snippet compiles without any other modification, this in order to help you best.