Comments (5)
See pull request #441 for the fix to both these issues.
The correct output displayed in the screenshot section is the result from the fixed branch.
from vhs.
@maaslalani Are you able to verify this issue exists for you as well?
from vhs.
@maaslalani You probably missed this issue with the flurry of issues and pull requests I have been creating.
Can we verify this issue is reproducible and check that the pull request does fix the issue?
from vhs.
I am basing alt
on what Bubbletea defines it as. This might need a lot more thinking about how we handle this.
from vhs.
Definition
I think it is important to firstly clarify what the alt
key means.
For me, on a Mac, I am pressing the option
key which has been configured by iTerm2 to send Esc+
.
We need to remove what terminal and OS (and even keyboard) is being used and just look at it as messages. What really matters is what alt
means in the Charm ecosystem. If I build a Bubbletea app that does an action when pressing alt
, I should expect something to happen.
Therefore, let's base the answer on what tea.KeyMsg
sees.
Testing
So we need two parts to prove this.
- Bubbletea application that responds to
alt
key presses. - VHS tape that sends this key press.
Application
The following code is a short Bubbletea application that responds to alt
+ s
. Using the string key message means we can be sure we are handling the exact case we are targeting.
package main
import (
"fmt"
tea "github.com/charmbracelet/bubbletea"
)
type Model struct {
state bool
text string
}
func main() {
p := tea.NewProgram(Model{
state: false,
text: "disabled",
})
if _, err := p.Run(); err != nil {
panic(err)
}
}
func (m Model) Init() tea.Cmd {
return nil
}
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "alt+s":
switch m.state {
case true:
m.text = "disabled"
m.state = false
default:
m.text = "enabled"
m.state = true
}
case "ctrl+c", "q":
return m, tea.Quit
}
}
return m, nil
}
func (m Model) View() string {
return fmt.Sprintf("Press Alt+S to toggle state\nState: %v\n", m.text)
}
Tape
Now lets add a VHS tape that will run this app and send the alt
+ s
key a few times. Recommending doing a go run .
before using this script to make sure it starts quickly and doesn't miss the alt
+ s
key presses.
Output alts.gif
Type "go run ."
Enter
Sleep 1s
Alt+S
Sleep 1s
Alt+S
Sleep 1s
Ctrl+C
Ctrl+D
Results
All that was needed was to now run VHS on this tape:
vhs alts.tape
VHS stable release
I have used the current release provided by Homebrew. Reported version is:
❯ vhs --version
vhs version v0.7.1 (537d03a)
As you can see, nothing happens.
VHS branch fix/alt
This is using the code I have provided in pull request #441.
This shows the text message toggles.
Outcome
Based on these results I conclude that the current VHS implementation sending some alt
key presses isn't working as expected.
@maaslalani Let me know if there is any further details you need me to provide so we can understand what the correct solution is.
from vhs.
Related Issues (20)
- Outputs ignored if specifying more than one golden file format
- Source 1_example.tape raises "Expected path after Source" HOT 1
- Add option for split terminal HOT 6
- Padding and FontSize not applied via Source
- Add Command to "Set Title" for Window
- vhs freezes when i try to load a file HOT 6
- Automatic download and execution of browser from Google should be noted in README HOT 1
- serve mode not working HOT 10
- Output frames don't do anything HOT 1
- Hide `vhs publish` info when exiting with tape errors HOT 1
- Escaped prompt when running VHS in a nix shell
- Support customizing Padding and Margin.
- Make VHS available as a library to be used in test suites and make possible programmatically detect golden file changes HOT 1
- Show what is being entered HOT 3
- Publish command stalls (server unresponsive?) HOT 3
- Show output in real-time HOT 2
- PlaybackSpeed, Long-running processes, Weird non-blocking behaviour
- Windows Defender Quarantines the VHS Executable
- Bubblegum textinput app not being rendered
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vhs.