| 370 | |
| 371 | class ShowDiffCommand(DiffCommand, sublime_plugin.TextCommand): |
| 372 | def diff_done(self, result): |
| 373 | self.log('on show_diff', result) |
| 374 | |
| 375 | if not result.strip(): |
| 376 | return |
| 377 | |
| 378 | result = result.replace('\r\n', '\n') |
| 379 | file_name = re.findall(r'([^\\\/]+)$', self.view.file_name()) |
| 380 | scratch = self.scratch(result, title="Diff - " + file_name[0]) |
| 381 | |
| 382 | # Select the line in the diff output where the cursor is located. |
| 383 | point = self.view.sel()[0].b |
| 384 | region = self.view.line(point) |
| 385 | line = self.view.substr(region) |
| 386 | |
| 387 | region = scratch.find(line, 0, sublime.LITERAL) |
| 388 | scratch.show_at_center(region) |
| 389 | scratch.sel().clear() |
| 390 | # Place the cursor at the beginning of the line |
| 391 | scratch.sel().add(scratch.line(region).a) |
| 392 | |
| 393 | |
| 394 | class DiffParser(object): |