summaryrefslogtreecommitdiff
path: root/cmd/init.go
diff options
context:
space:
mode:
authorHimanshu Sardana <himanshusardana2005@gmail.com>2026-03-28 00:33:36 +0000
committerHimanshu Sardana <himanshusardana2005@gmail.com>2026-03-28 00:33:36 +0000
commit7a5c0d55c421f42bdcad32d42a0e84a6d932c852 (patch)
tree5bfd7c4331afa122b800be53f3c950c892815de6 /cmd/init.go
parent98877caafbce3788df722292b39a6d98754b1c7e (diff)
fix: escape key handling
Diffstat (limited to 'cmd/init.go')
-rw-r--r--cmd/init.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/cmd/init.go b/cmd/init.go
index ae65562..1b7dd62 100644
--- a/cmd/init.go
+++ b/cmd/init.go
@@ -89,12 +89,18 @@ func (i listItem) FilterValue() string { return i.title }
func (m *InitModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if m.step == 5 {
- if keyMsg, ok := msg.(tea.KeyMsg); ok && keyMsg.String() == "enter" {
- selected := m.themeList.SelectedItem().(listItem)
- m.theme = selected.title
- m.step++
- m.finished = true
- return m, tea.Quit
+ if keyMsg, ok := msg.(tea.KeyMsg); ok {
+ if keyMsg.String() == "enter" {
+ selected := m.themeList.SelectedItem().(listItem)
+ m.theme = selected.title
+ m.step++
+ m.finished = true
+ return m, tea.Quit
+ }
+ if keyMsg.String() == "esc" {
+ m.quitting = true
+ return m, tea.Quit
+ }
}
var cmd tea.Cmd
m.themeList, cmd = m.themeList.Update(msg)
@@ -106,7 +112,7 @@ func (m *InitModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg.String() {
case "ctrl+c", "esc":
m.quitting = true
- return m, nil
+ return m, tea.Quit
case "enter":
return m.handleEnter()
case "backspace":