charmbracelet / charmbracelet/vhs
Should a new line terminate a command?
- Dominant language
- Go
- Stars
- 20.9k
- Forks
- 480
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
When an invalid identifier follows a Type identifier, the invalid identifier is considered as part of the command even when there is a new line separating them. If I understood the code correctly it is because every white space is handled the same outside of string literals.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a tape file with the following content:
```
Type "echo 'Hello, World!'"
Enter1
Sleep 1
```
2. Run the tape
**Source Code**
https://github.com/charmbracelet/vhs/blob/04e743a9fac3f9e0f0beb42de2363a2fe6137f44/parser/parser.go#L586-L596
**Expected behavior**
I think this should raise an error for invalid identifier. But only when there is a new line between them.
**Additional context**
Is this expected to work?
```
Set
Width
300
Type
"echo"
"'Hello,"
"World!'"
```
Contributor guide
Research direction
Start with parser/parser.go around lines 586-596 and reproduce the issue using the tape content in the report. Trace how whitespace and newlines are handled between the Type command and its argument; done means an invalid identifier separated by a newline raises an error while quoted multiline input continues to parse as shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100