Skip to content

Commit

Permalink
feat: fixed width of labels
Browse files Browse the repository at this point in the history
  • Loading branch information
achannarasappa committed Mar 2, 2021
1 parent 4964870 commit a00bb4a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions internal/ui/component/watchlist/watchlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func buildCells(quote Quote, position Position, config c.Config) []grid.Cell {
if config.ShowHoldings {
cells = append(
[]grid.Cell{
{Text: textPositionExtendedLabels(position), Align: grid.Right, VisibleMinWidth: widthMinTerm + 15},
{Text: textPositionExtendedLabels(position), Width: 15, Align: grid.Right, VisibleMinWidth: widthMinTerm + 15},
{Text: textPositionExtended(quote, position), Width: 7, Align: grid.Right, VisibleMinWidth: widthMinTerm},
},
cells...,
Expand All @@ -121,9 +121,9 @@ func buildCells(quote Quote, position Position, config c.Config) []grid.Cell {
if config.ExtraInfoFundamentals {
cells = append(
[]grid.Cell{
{Text: textQuoteRangeLabels(quote), Align: grid.Right, VisibleMinWidth: widthMinTerm + 45},
{Text: textQuoteRangeLabels(quote), Width: 15, Align: grid.Right, VisibleMinWidth: widthMinTerm + 45},
{Text: textQuoteRange(quote), Width: 15, Align: grid.Right, VisibleMinWidth: widthMinTerm + 30},
{Text: textQuoteExtendedLabels(quote), Align: grid.Right, VisibleMinWidth: widthMinTerm + 15},
{Text: textQuoteExtendedLabels(quote), Width: 15, Align: grid.Right, VisibleMinWidth: widthMinTerm + 15},
{Text: textQuoteExtended(quote), Width: 7, Align: grid.Right, VisibleMinWidth: widthMinTerm},
},
cells...,
Expand All @@ -140,6 +140,11 @@ func buildCells(quote Quote, position Position, config c.Config) []grid.Cell {
}

func textName(quote Quote) string {

if len(quote.ShortName) > 20 {
quote.ShortName = quote.ShortName[:20]
}

return StyleNeutralBold(quote.Symbol) +
"\n" +
StyleNeutralFaded(quote.ShortName)
Expand Down

0 comments on commit a00bb4a

Please sign in to comment.