Conversation and Author screens styled to match; glyph policy chosen from measurement
This commit is contained in:
45
tui/frame.go
45
tui/frame.go
@@ -185,19 +185,19 @@ func statusPill(status string) string {
|
||||
func statusLabel(status string) (string, string) {
|
||||
switch status {
|
||||
case "in_progress":
|
||||
return "▶ running ", active.Info
|
||||
return icons.Running + " running ", active.Info
|
||||
case "blocked":
|
||||
return "■ blocked ", active.Error
|
||||
return icons.Blocked + " blocked ", active.Error
|
||||
case "in_review":
|
||||
return "◆ review ", active.Warning
|
||||
return icons.Review + " review ", active.Warning
|
||||
case "done":
|
||||
return "✓ done ", active.Success
|
||||
return icons.Done + " done ", active.Success
|
||||
case "cancelled":
|
||||
return "✕ cancel ", active.Overlay
|
||||
return icons.Cancelled + " cancel ", active.Overlay
|
||||
case "backlog":
|
||||
return "· backlog ", active.Muted
|
||||
return icons.Todo + " backlog ", active.Muted
|
||||
default:
|
||||
return "· todo ", active.Text
|
||||
return icons.Todo + " todo ", active.Text
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,3 +240,34 @@ func fmtCount(n int, one, many string) string {
|
||||
}
|
||||
return fmt.Sprintf("%d %s", n, many)
|
||||
}
|
||||
|
||||
// wrap breaks one paragraph into lines no wider than w, on word boundaries.
|
||||
// It is used for anything a person wrote, so it never cuts a word in half.
|
||||
func wrap(s string, w int) []string {
|
||||
if w < 4 {
|
||||
w = 4
|
||||
}
|
||||
if s == "" {
|
||||
return []string{""}
|
||||
}
|
||||
var lines []string
|
||||
cur := ""
|
||||
for _, word := range strings.Fields(s) {
|
||||
switch {
|
||||
case cur == "":
|
||||
cur = word
|
||||
case len([]rune(cur))+1+len([]rune(word)) <= w:
|
||||
cur += " " + word
|
||||
default:
|
||||
lines = append(lines, cur)
|
||||
cur = word
|
||||
}
|
||||
}
|
||||
if cur != "" {
|
||||
lines = append(lines, cur)
|
||||
}
|
||||
if len(lines) == 0 {
|
||||
return []string{""}
|
||||
}
|
||||
return lines
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user