fix: no empty input & error out on chat in status buffer
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
eaed66df6b
commit
f8039aec33
11
ui/model.go
11
ui/model.go
@ -240,9 +240,18 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
|
|
||||||
case "enter":
|
case "enter":
|
||||||
cmdInput := m.input.Value()
|
cmdInput := m.input.Value()
|
||||||
if len(cmdInput) == 0 || string(cmdInput[0]) != "/" {
|
if len(cmdInput) == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if string(cmdInput[0]) != "/" && m.menuState == 0 {
|
||||||
|
cmds = append(cmds, func() tea.Msg {
|
||||||
|
errMsg := "Woops, this is not a chat buffer. Only commands are allowed"
|
||||||
|
return cmdMsg{output: []string{errMsg}}
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
cmds = append(cmds, func() tea.Msg {
|
cmds = append(cmds, func() tea.Msg {
|
||||||
return handleCommand(cmdInput[1:], m.hiddenInput)
|
return handleCommand(cmdInput[1:], m.hiddenInput)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user