Browse Source

Merge f681520fa6 into dedd2d169f

pull/218/merge
Maarten van Gompel 3 years ago committed by GitHub
parent
commit
f79e8a6fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      config/config.go
  2. 47
      ui/item.go
  3. 2
      ui/mainview.go

5
config/config.go

@ -166,6 +166,8 @@ type General struct {
ContentProportion int
TerminalTitle int
ShowIcons bool
SymbolWidth int
SymbolFormat string
ShowHelp bool
RedrawUI bool
LeaderKey rune
@ -851,6 +853,9 @@ func parseGeneral(cfg *ini.File) General {
general.ShortHints = cfg.Section("general").Key("short-hints").MustBool(false)
general.ShowFilterPhrase = cfg.Section("general").Key("show-filter-phrase").MustBool(true)
general.ShowIcons = cfg.Section("general").Key("show-icons").MustBool(true)
general.SymbolWidth = cfg.Section("general").Key("symbol-width").MustInt(6)
symbolFormat := "%" + fmt.Sprintf("%d", general.SymbolWidth) + "s"
general.SymbolFormat = cfg.Section("general").Key("symbol-format").MustString(symbolFormat)
general.ShowHelp = cfg.Section("general").Key("show-help").MustBool(true)
general.RedrawUI = cfg.Section("general").Key("redraw-ui").MustBool(true)
general.StickToTop = cfg.Section("general").Key("stick-to-top").MustBool(false)

47
ui/item.go

@ -20,12 +20,31 @@ func DrawListItem(cfg *config.Config, item api.Item) (string, string) {
status := s
if s.Reblog != nil {
status = s.Reblog
}
if status.RepliesCount > 0 {
symbol = " ⤶ "
symbol += "♺ "
}
if item.Pinned() {
symbol = " ! "
symbol += "! "
}
if s.Bookmarked {
symbol += "☜ "
}
if s.Favourited {
symbol += "★ "
}
if s.Poll != nil {
symbol += "= "
}
if s.Sensitive || s.SpoilerText != "" {
symbol += "⚑ "
}
if len(s.MediaAttachments) > 0 {
symbol += "⚭ "
}
if s.Card != nil {
symbol += "⚯ "
}
if status.RepliesCount > 0 {
symbol += "⤷ "
}
acc := strings.TrimSpace(s.Account.Acct)
if cfg.General.ShowBoostedUser && s.Reblog != nil {
@ -35,6 +54,9 @@ func DrawListItem(cfg *config.Config, item api.Item) (string, string) {
acc = fmt.Sprintf("♺ %s", acc)
}
d := OutputDate(cfg, s.CreatedAt.Local())
if symbol != "" {
symbol = fmt.Sprintf(cfg.General.SymbolFormat, symbol)
}
return fmt.Sprintf("%s %s", d, acc), symbol
case api.StatusHistoryType:
s := item.Raw().(*mastodon.StatusHistory)
@ -51,19 +73,22 @@ func DrawListItem(cfg *config.Config, item api.Item) (string, string) {
symbol := ""
switch a.Item.Type {
case "follow", "follow_request":
symbol += " + "
symbol += "+ "
case "favourite":
symbol = " ★ "
symbol = "★ "
case "reblog":
symbol = " ♺ "
symbol = "♺ "
case "mention":
symbol = " ⤶ "
symbol = "⤶ "
case "update":
symbol = " ☢ "
symbol = "☢ "
case "poll":
symbol = " = "
symbol = "= "
case "status":
symbol = " ⤶ "
symbol = "⤶ "
}
if symbol != "" {
symbol = fmt.Sprintf(cfg.General.SymbolFormat, symbol)
}
d := OutputDate(cfg, a.Item.CreatedAt.Local())
return fmt.Sprintf("%s %s", d, strings.TrimSpace(a.Item.Account.Acct)), symbol

2
ui/mainview.go

@ -31,7 +31,7 @@ func (mv *MainView) ForceUpdate() {
}
func feedList(mv *TutView, fh *FeedHolder) *tview.Flex {
iw := 3
iw := mv.tut.Config.General.SymbolWidth
if !mv.tut.Config.General.ShowIcons {
iw = 0
}

Loading…
Cancel
Save