Skip to content

Commit

Permalink
feat: add new text input styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Benzbeeb committed Sep 10, 2024
1 parent 5e232b2 commit d81319f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions models/weaveinit/run_l1_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (m *RunL1NodeVersionInput) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
input, cmd, done := m.TextInput.Update(msg)
if done {
m.state.initiadVersion = input.Text
return NewRunL1NodeChainIdInput(m.state), nil
return NewRunL1NodeChainIdInput(m.state), cmd
}
m.TextInput = input
return m, cmd
Expand Down Expand Up @@ -118,7 +118,7 @@ func (m *RunL1NodeChainIdInput) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
input, cmd, done := m.TextInput.Update(msg)
if done {
m.state.chainId = input.Text
return NewRunL1NodeMonikerInput(m.state), nil
return NewRunL1NodeMonikerInput(m.state), cmd
}
m.TextInput = input
return m, cmd
Expand Down Expand Up @@ -277,7 +277,7 @@ func (m *MinGasPriceInput) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
input, cmd, done := m.TextInput.Update(msg)
if done {
m.state.minGasPrice = input.Text
return NewEnableFeaturesCheckbox(m.state), nil
return NewEnableFeaturesCheckbox(m.state), cmd
}
m.TextInput = input
return m, cmd
Expand Down Expand Up @@ -359,7 +359,7 @@ func (m *SeedsInput) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
input, cmd, done := m.TextInput.Update(msg)
if done {
m.state.seeds = input.Text
return NewPersistentPeersInput(m.state), nil
return NewPersistentPeersInput(m.state), cmd
}
m.TextInput = input
return m, cmd
Expand Down
4 changes: 3 additions & 1 deletion utils/text_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ func (ti TextInput) Update(msg tea.Msg) (TextInput, tea.Cmd, bool) {
case tea.KeyMsg:
switch msg.Type {
case tea.KeyEnter:
return ti, nil, true
ti.Entered = true
return ti, nil, false
case tea.KeyBackspace, tea.KeyCtrlH:
if ti.Cursor > 0 && len(ti.Text) > 0 {
ti.Text = ti.Text[:ti.Cursor-1] + ti.Text[ti.Cursor:]
Expand All @@ -43,6 +44,7 @@ func (ti TextInput) Update(msg tea.Msg) (TextInput, tea.Cmd, bool) {
case tea.KeyCtrlC:
return ti, tea.Quit, false
}

}
return ti, nil, false
}
Expand Down

0 comments on commit d81319f

Please sign in to comment.