MCPcopy
hub / github.com/ddworken/hishtory / New

Function New

client/table/table.go:176–196  ·  view source on GitHub ↗

New creates a new model for the table widget.

(opts ...Option)

Source from the content-addressed store, hash-verified

174
175// New creates a new model for the table widget.
176func New(opts ...Option) Model {
177 m := Model{
178 cursor: 0,
179 viewport: viewport.New(0, 20),
180
181 KeyMap: DefaultKeyMap(),
182 styles: DefaultStyles(),
183
184 hcol: -1,
185 hstep: 10,
186 hcursor: 0,
187 }
188
189 for _, opt := range opts {
190 opt(&m)
191 }
192
193 m.UpdateViewport()
194
195 return m
196}
197
198// WithColumns sets the table columns (headers).
199func WithColumns(cols []Column) Option {

Callers 4

makeTableFunction · 0.92
TestFromValuesFunction · 0.85
TestHScollFunction · 0.85

Calls 3

UpdateViewportMethod · 0.95
DefaultKeyMapFunction · 0.85
DefaultStylesFunction · 0.85

Tested by 3

TestFromValuesFunction · 0.68
TestHScollFunction · 0.68