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

Method prevDiff

texteditor/diffeditor.go:249–272  ·  view source on GitHub ↗

prevDiff moves to previous diff region

(ab int)

Source from the content-addressed store, hash-verified

247
248// prevDiff moves to previous diff region
249func (dv *DiffEditor) prevDiff(ab int) bool {
250 tva, tvb := dv.textEditors()
251 tv := tva
252 if ab == 1 {
253 tv = tvb
254 }
255 curLn := tv.CursorPos.Ln
256 di, df := dv.alignD.DiffForLine(curLn)
257 if di < 0 {
258 return false
259 }
260 for {
261 di--
262 if di < 0 {
263 return false
264 }
265 df = dv.alignD[di]
266 if df.Tag != 'e' {
267 break
268 }
269 }
270 tva.SetCursorTarget(lexer.Pos{Ln: df.I1})
271 return true
272}
273
274// saveAs saves A or B edits into given file.
275// It checks for an existing file, prompts to overwrite or not.

Callers 1

MakeToolbarMethod · 0.95

Calls 3

textEditorsMethod · 0.95
DiffForLineMethod · 0.80
SetCursorTargetMethod · 0.80

Tested by

no test coverage detected