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

Method Init

texteditor/diffeditor.go:665–687  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

663}
664
665func (ed *DiffTextEditor) Init() {
666 ed.Editor.Init()
667 ed.Styler(func(s *styles.Style) {
668 s.Grow.Set(1, 1)
669 })
670 ed.OnDoubleClick(func(e events.Event) {
671 pt := ed.PointToRelPos(e.Pos())
672 if pt.X >= 0 && pt.X < int(ed.LineNumberOffset) {
673 newPos := ed.PixelToCursor(pt)
674 ln := newPos.Ln
675 dv := ed.diffEditor()
676 if dv != nil && ed.Buffer != nil {
677 if ed.Name == "text-a" {
678 dv.applyDiff(0, ln)
679 } else {
680 dv.applyDiff(1, ln)
681 }
682 }
683 e.SetHandled()
684 return
685 }
686 })
687}
688
689func (ed *DiffTextEditor) diffEditor() *DiffEditor {
690 return tree.ParentByType[*DiffEditor](ed)

Callers

nothing calls this directly

Calls 10

diffEditorMethod · 0.95
StylerMethod · 0.80
OnDoubleClickMethod · 0.80
PointToRelPosMethod · 0.80
PixelToCursorMethod · 0.80
applyDiffMethod · 0.80
InitMethod · 0.65
SetMethod · 0.65
PosMethod · 0.65
SetHandledMethod · 0.65

Tested by

no test coverage detected