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

Method ViewDiff

texteditor/diffbrowser/browser.go:92–107  ·  view source on GitHub ↗

ViewDiff views diff for given file Node, returning a texteditor.DiffEditor

(fn *Node)

Source from the content-addressed store, hash-verified

90
91// ViewDiff views diff for given file Node, returning a texteditor.DiffEditor
92func (br *Browser) ViewDiff(fn *Node) *texteditor.DiffEditor {
93 df := fsx.DirAndFile(fn.FileA)
94 tabs := br.Tabs()
95 tab := tabs.RecycleTab(df)
96 if tab.HasChildren() {
97 dv := tab.Child(1).(*texteditor.DiffEditor)
98 return dv
99 }
100 tb := core.NewToolbar(tab)
101 dv := texteditor.NewDiffEditor(tab)
102 tb.Maker(dv.MakeToolbar)
103 dv.SetFileA(fn.FileA).SetFileB(fn.FileB).SetRevisionA(fn.RevA).SetRevisionB(fn.RevB)
104 dv.DiffStrings(stringsx.SplitLines(fn.TextA), stringsx.SplitLines(fn.TextB))
105 br.Update()
106 return dv
107}

Callers 2

InitMethod · 0.80
ContextMenuMethod · 0.80

Calls 15

TabsMethod · 0.95
SetFileAMethod · 0.95
DiffStringsMethod · 0.95
DirAndFileFunction · 0.92
NewToolbarFunction · 0.92
NewDiffEditorFunction · 0.92
SplitLinesFunction · 0.92
RecycleTabMethod · 0.80
ChildMethod · 0.80
MakerMethod · 0.80
SetRevisionBMethod · 0.80
SetRevisionAMethod · 0.80

Tested by

no test coverage detected