feat: shift focus from one window to another. and make code consistent

This commit is contained in:
2021-12-31 00:04:58 +02:00
parent b32af9d55f
commit ba7e881516
5 changed files with 85 additions and 43 deletions
+3 -9
View File
@@ -30,22 +30,16 @@ type InputState struct {
func NewInputBox() InputState {
input := textinput.NewModel()
input.Placeholder = "Send a message..."
// input.Focus()
state := InputState{input, InputboxStyle}
input.Focus()
state := InputState{input, InputboxStyle.Copy()}
return state
}
func (s InputState) Update(msg tea.Msg) (InputState, tea.Cmd) {
cmd := s.updateInputs(msg)
return s, cmd
}
func (s *InputState) updateInputs(msg tea.Msg) tea.Cmd {
var cmd tea.Cmd
s.Input, cmd = s.Input.Update(msg)
return cmd
return s, cmd
}
func (s *InputState) SetSize(width int) {