mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
Add more context to stash fail status messages + make them red
This commit is contained in:
parent
35f1ed21c3
commit
6be1af4103
1 changed files with 6 additions and 3 deletions
|
@ -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: "Couldn’t stash :(",
|
||||
status: errorStatusMessage,
|
||||
message: fmt.Sprintf("Couldn’t 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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue