fix: no empty input & error out on chat in status buffer
continuous-integration/drone/push Build is passing Details

This commit is contained in:
decentral1se 2023-12-29 20:04:49 +01:00
parent eaed66df6b
commit f8039aec33
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
1 changed files with 10 additions and 1 deletions

View File

@ -240,9 +240,18 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case "enter":
cmdInput := m.input.Value()
if len(cmdInput) == 0 || string(cmdInput[0]) != "/" {
if len(cmdInput) == 0 {
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 {
return handleCommand(cmdInput[1:], m.hiddenInput)
})