(diffID diffID)
| 372 | } |
| 373 | |
| 374 | func (diffView *DiffView) switchToDiffIfExists(diffID diffID) (exists bool) { |
| 375 | diffLines, exists := diffView.diffs[diffID] |
| 376 | if exists { |
| 377 | if diffLines.diffType != diffView.currentDiffProcessorType() { |
| 378 | diffProcessor, diffType := diffView.currentDiffProcessor() |
| 379 | lines, err := diffProcessor.processDiff(diffLines.rawLines) |
| 380 | |
| 381 | if err != nil { |
| 382 | log.Errorf("Failed to convert diff to format %v: %v", diffType, err) |
| 383 | diffLines.diffType = dptGit |
| 384 | diffLines.lines = diffLines.rawLines |
| 385 | } else { |
| 386 | diffLines.diffType = diffType |
| 387 | diffLines.lines = lines |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | diffView.activeDiff = diffID |
| 392 | diffView.activeViewPos = diffLines.viewPos |
| 393 | diffView.setVariables() |
| 394 | diffView.channels.UpdateDisplay() |
| 395 | } |
| 396 | |
| 397 | return |
| 398 | } |
| 399 | |
| 400 | // OnFileSelected loads/fetches the diff for the selected file and refreshes the display |
| 401 | func (diffView *DiffView) OnFileSelected(statusType StatusType, filePath string) { |
no test coverage detected