charmbracelet / vhs

Your CLI home video recorder 📼
MIT License
15.2k stars 258 forks source link

Ghost text and ansi escape codes at the beginning of tape arent setting the proper settings #269

Open sweetbbak opened 1 year ago

sweetbbak commented 1 year ago

I saw #39 and Im having a similar issue to that, the proposed solution was to add Hide and Sleep to the beginning of the tape, however no matter how long I do that the same type of text shows up. I'm not sure if its because of the shell or if its a part of how VHS starts things. I can add Type clear and sleep to the beginning but you can still see the history making the text appear when it shouldn't as show below.

lain

Output lain.gif

Enter
Hide Sleep 15s Show
Enter
Enter

Set FontFamily "Maple Mono"

# Set up a 1200x600 terminal with 46px font.
Set FontSize 46
Set Width 1200
Set Height 600

Sleep 100ms

# Type a command in the terminal.
Type@500ms "Hello...?"

Backspace 10

# Pause for dramatic effect...
Sleep 500ms

Type 'Are you there?'

# Run the command by pressing enter.
Enter

Backspace

Type "neofetch"
Enter

# Admire the output for a bit.
Sleep 5s
joshka commented 1 year ago

The code for detecting whether to skip the first part of a tape only triggers when the first (non setup) command is Hide. It needs to come before the "Enter" command. Not sure if you need to put the commands on different lines.

I find that this is useful for skipping output of the build output that might show prior to running some example. e.g.:

Hide
cargo run --example demo
Sleep 10s
Show
... rest of demo script
sweetbbak commented 1 year ago

Thanks! I appreciate it.