MCPcopy Create free account
hub / github.com/cogentcore/core / Init

Method Init

texteditor/diffeditor.go:152–181  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150}
151
152func (dv *DiffEditor) Init() {
153 dv.Frame.Init()
154 dv.bufferA = NewBuffer()
155 dv.bufferB = NewBuffer()
156 dv.bufferA.Options.LineNumbers = true
157 dv.bufferB.Options.LineNumbers = true
158
159 dv.Styler(func(s *styles.Style) {
160 s.Grow.Set(1, 1)
161 })
162
163 f := func(name string, buf *Buffer) {
164 tree.AddChildAt(dv, name, func(w *DiffTextEditor) {
165 w.SetBuffer(buf)
166 w.SetReadOnly(true)
167 w.Styler(func(s *styles.Style) {
168 s.Min.X.Ch(80)
169 s.Min.Y.Em(40)
170 })
171 w.On(events.Scroll, func(e events.Event) {
172 dv.syncEditors(events.Scroll, e, name)
173 })
174 w.On(events.Input, func(e events.Event) {
175 dv.syncEditors(events.Input, e, name)
176 })
177 })
178 }
179 f("text-a", dv.bufferA)
180 f("text-b", dv.bufferB)
181}
182
183func (dv *DiffEditor) updateToolbar() {
184 tb := dv.Scene.GetTopAppBar()

Callers

nothing calls this directly

Calls 11

syncEditorsMethod · 0.95
AddChildAtFunction · 0.92
StylerMethod · 0.80
NewBufferFunction · 0.70
InitMethod · 0.65
SetMethod · 0.65
SetBufferMethod · 0.45
SetReadOnlyMethod · 0.45
ChMethod · 0.45
EmMethod · 0.45
OnMethod · 0.45

Tested by

no test coverage detected