Skip to content
Myr

docs(examples): fix panics in table-width example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent 9f015c5 · Browse files · 1 file+14 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−2 removed

  • other:+14 added−2 removed

1 file+14 added−2 removed

modified:examples/table-resize/main.go+14 added-2 removed
102 unmodified lines
103 if row == 0 {104 return headerStyle105 }106107 rowIndex := row - 1108 if rowIndex < 0 || rowIndex >= len(rows) {109 return baseStyle110 }111107 if rows[row-1][1] == "Pikachu" {112 if rows[rowIndex][1] == "Pikachu" {113 return selectedStyle114 }115116 even := row%2 == 0
4 unmodified lines
121 if even {122 c = dimTypeColors123 }124120 color := c[fmt.Sprint(rows[row-1][col])]125 if col >= len(rows[rowIndex]) {126 return baseStyle127 }128129 color, ok := c[rows[rowIndex][col]]130 if !ok {131 return baseStyle132 }133 return baseStyle.Foreground(color)134 }135136 if even {
12 unmodified lines