(v *gocui.View, maxX int)
| 299 | } |
| 300 | |
| 301 | func (bt *bugTable) render(v *gocui.View, maxX int) { |
| 302 | columnWidths := bt.getColumnWidths(maxX) |
| 303 | |
| 304 | for _, excerpt := range bt.excerpts { |
| 305 | summaryTxt := fmt.Sprintf("%3d", excerpt.LenComments-1) |
| 306 | if excerpt.LenComments-1 <= 0 { |
| 307 | summaryTxt = "" |
| 308 | } |
| 309 | if excerpt.LenComments-1 > 999 { |
| 310 | summaryTxt = " ∞" |
| 311 | } |
| 312 | |
| 313 | var labelsTxt strings.Builder |
| 314 | for _, l := range excerpt.Labels { |
| 315 | labelsTxt.WriteString(" ") |
| 316 | lc256 := l.Color().Term256() |
| 317 | labelsTxt.WriteString(lc256.Escape()) |
| 318 | labelsTxt.WriteString("◼") |
| 319 | labelsTxt.WriteString(lc256.Unescape()) |
| 320 | } |
| 321 | |
| 322 | author, err := bt.repo.Identities().ResolveExcerpt(excerpt.AuthorId) |
| 323 | if err != nil { |
| 324 | panic(err) |
| 325 | } |
| 326 | |
| 327 | id := text.LeftPadMaxLine(excerpt.Id().Human(), columnWidths["id"], 0) |
| 328 | status := text.LeftPadMaxLine(excerpt.Status.String(), columnWidths["status"], 0) |
| 329 | labels := text.TruncateMax(labelsTxt.String(), minInt(columnWidths["title"]-2, 10)) |
| 330 | title := text.LeftPadMaxLine(strings.TrimSpace(excerpt.Title), columnWidths["title"]-text.Len(labels), 0) |
| 331 | authorTxt := text.LeftPadMaxLine(author.DisplayName(), columnWidths["author"], 0) |
| 332 | comments := text.LeftPadMaxLine(summaryTxt, columnWidths["comments"], 0) |
| 333 | lastEdit := text.LeftPadMaxLine(humanize.Time(excerpt.EditTime()), columnWidths["lastEdit"], 1) |
| 334 | |
| 335 | _, _ = fmt.Fprintf(v, "%s %s %s%s %s %s %s\n", |
| 336 | colors.Cyan(id), |
| 337 | colors.Yellow(status), |
| 338 | title, |
| 339 | labels, |
| 340 | colors.Magenta(authorTxt), |
| 341 | comments, |
| 342 | lastEdit, |
| 343 | ) |
| 344 | } |
| 345 | |
| 346 | _ = v.SetHighlight(bt.selectCursor, true) |
| 347 | } |
| 348 | |
| 349 | func (bt *bugTable) renderHeader(v *gocui.View, maxX int) { |
| 350 | columnWidths := bt.getColumnWidths(maxX) |
no test coverage detected