Add more context to stash fail status messages + make them red

This commit is contained in:
Christian Rocha 2020-12-18 16:26:03 -05:00
parent 35f1ed21c3
commit 6be1af4103

View file

@ -132,6 +132,7 @@ type statusMessageType int
const (
normalStatusMessage statusMessageType = iota
subtleStatusMessage
errorStatusMessage
)
// statusMessage is an ephemeral note displayed in the UI.
@ -146,6 +147,8 @@ func (s statusMessage) String() string {
switch s.status {
case subtleStatusMessage:
return dimGreenFg(s.message)
case errorStatusMessage:
return redFg(s.message)
default:
return greenFg(s.message)
}
@ -652,8 +655,8 @@ func (m stashModel) update(msg tea.Msg) (stashModel, tea.Cmd) {
// update function.
case stashFailMsg:
cmds = append(cmds, m.newStatusMessage(statusMessage{
status: normalStatusMessage,
message: "Couldnt stash :(",
status: errorStatusMessage,
message: fmt.Sprintf("Couldnt stash %s", msg.markdown.Note),
}))
case statusMessageTimeoutMsg:
@ -1151,7 +1154,7 @@ func (m stashModel) view() string {
logoOrFilter += " " + m.statusMessage.String()
}
}
logoOrFilter = truncate.StringWithTail(logoOrFilter, uint(m.common.width), ellipsis)
logoOrFilter = truncate.StringWithTail(logoOrFilter, uint(m.common.width-1), ellipsis)
help, helpHeight := m.helpView()