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

Method syncEditors

texteditor/diffeditor.go:201–219  ·  view source on GitHub ↗

syncEditors synchronizes the text [Editor] scrolling and cursor positions

(typ events.Types, e events.Event, name string)

Source from the content-addressed store, hash-verified

199
200// syncEditors synchronizes the text [Editor] scrolling and cursor positions
201func (dv *DiffEditor) syncEditors(typ events.Types, e events.Event, name string) {
202 tva, tvb := dv.textEditors()
203 me, other := tva, tvb
204 if name == "text-b" {
205 me, other = tvb, tva
206 }
207 switch typ {
208 case events.Scroll:
209 other.Geom.Scroll.Y = me.Geom.Scroll.Y
210 other.ScrollUpdateFromGeom(math32.Y)
211 case events.Input:
212 if dv.inInputEvent {
213 return
214 }
215 dv.inInputEvent = true
216 other.SetCursorShow(me.CursorPos)
217 dv.inInputEvent = false
218 }
219}
220
221// nextDiff moves to next diff region
222func (dv *DiffEditor) nextDiff(ab int) bool {

Callers 1

InitMethod · 0.95

Calls 3

textEditorsMethod · 0.95
ScrollUpdateFromGeomMethod · 0.80
SetCursorShowMethod · 0.80

Tested by

no test coverage detected