MCPcopy
hub / github.com/mum4k/termdash / New

Function New

widgets/segmentdisplay/segmentdisplay.go:71–89  ·  view source on GitHub ↗

New returns a new SegmentDisplay.

(opts ...Option)

Source from the content-addressed store, hash-verified

69
70// New returns a new SegmentDisplay.
71func New(opts ...Option) (*SegmentDisplay, error) {
72 opt := newOptions()
73 for _, o := range opts {
74 o.set(opt)
75 }
76 if err := opt.validate(); err != nil {
77 return nil, err
78 }
79
80 dotChars := map[rune]bool{}
81 for _, r := range dotseg.SupportedChars() {
82 dotChars[r] = true
83 }
84 return &SegmentDisplay{
85 wOptsTracker: attrrange.NewTracker(),
86 opts: opt,
87 dotChars: dotChars,
88 }, nil
89}
90
91// TextChunk is a part of or the full text that will be displayed.
92type TextChunk struct {

Callers 11

newSegmentDisplayFunction · 0.92
newControlsTabFunction · 0.92
explorerSegmentDisplayFunction · 0.92
mainFunction · 0.92
newControlsTabFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
TestSegmentDisplayFunction · 0.70
TestKeyboardFunction · 0.70
TestMouseFunction · 0.70
TestOptionsFunction · 0.70

Calls 5

SupportedCharsFunction · 0.92
NewTrackerFunction · 0.92
newOptionsFunction · 0.70
setMethod · 0.65
validateMethod · 0.45

Tested by 4

TestSegmentDisplayFunction · 0.56
TestKeyboardFunction · 0.56
TestMouseFunction · 0.56
TestOptionsFunction · 0.56