diff --git a/docs/src/quick-start.md b/docs/src/quick-start.md index abfedf77..33a1bb37 100644 --- a/docs/src/quick-start.md +++ b/docs/src/quick-start.md @@ -22,7 +22,7 @@ If your terminal is wider than 80 columns, you'll notice that the pane does not All actions in `cy`, such as creating panes and switching between them, are triggered by sequences of keys. -{{story cast cy/viewport -w 100}} +{{story cast cy/viewport --width 120 --height 26}} Here are a few you can try: @@ -34,6 +34,8 @@ Here are a few you can try: ## 3. Entering replay mode +{{story cast cy/replay}} + ## 4. Creating a new shell To create a new shell, type `ctrl+a` `j`. This creates a new pane running your default shell in your current working directory. You can return to the old one with `ctrl+l`; this cycles between all of the panes in the current **group**. In `cy`, a group is just a container for panes or other groups. diff --git a/pkg/cy/stories.go b/pkg/cy/stories.go index 069f199c..32e71ac3 100644 --- a/pkg/cy/stories.go +++ b/pkg/cy/stories.go @@ -66,14 +66,20 @@ func init() { stories.Register("cy/replay", Replay, stories.Config{ Input: []interface{}{ stories.Wait(stories.Some), - stories.Type("seq 1 100", "enter"), + stories.Type("this is a test", "enter"), + stories.Wait(stories.More), + stories.Type("seq 1 10", "enter"), stories.Wait(stories.More), stories.Type("ctrl+a", "p"), stories.Wait(stories.Some), - stories.Type("gg", "space"), + stories.Type("left", "left", "left", "left"), + stories.Wait(stories.ALot), + stories.Type("space"), + stories.Wait(stories.ALot), + stories.Type("?", "test", "enter"), + stories.Wait(stories.ALot), + stories.Type("h", "h", "h"), stories.Wait(stories.ALot), - stories.Type("@", "space"), - stories.Wait(stories.Some), }, }) } diff --git a/pkg/stories/ui/keys.go b/pkg/stories/ui/keys.go index 182d84d7..b2d47209 100644 --- a/pkg/stories/ui/keys.go +++ b/pkg/stories/ui/keys.go @@ -98,9 +98,13 @@ func (k *Keys) Update(msg tea.Msg) (taro.Model, tea.Cmd) { k.presses = k.presses[1:] return k, nil case taro.KeyMsg: + name := msg.String() + if string(msg.Runes) == " " || msg.Type == taro.KeySpace { + name = "space" + } k.presses = append(k.presses, keyPress{ stamp: time.Now(), - key: msg.String(), + key: name, }) return k, func() tea.Msg { time.Sleep(10 * time.Second)