From 521066a0e1ec3d361c0ae3c309c1073535cd811b Mon Sep 17 00:00:00 2001 From: Duncan Holm Date: Tue, 13 Mar 2018 08:56:47 +0000 Subject: [PATCH] Give diff-viewing tabs better name than 'untitled' --- git-blame.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git-blame.py b/git-blame.py index 4181fe7..f21d8d3 100644 --- a/git-blame.py +++ b/git-blame.py @@ -169,7 +169,7 @@ def on_phantom_close(self, href): elif intent == "show": desc = self.get_commit(sha, self.view.file_name()).decode('utf-8') buf = self.view.window().new_file() - buf.run_command('insert_commit_description', {'desc': desc}) + buf.run_command('insert_commit_description', {'desc': desc, 'scratch_view_name': 'commit ' + sha}) else: self.view.erase_phantoms('git-blame') else: @@ -182,7 +182,7 @@ def run(self, edit): if self.phantom_set.phantoms and self.view.line(self.view.sel()[0]) == self.view.line(self.phantom_set.phantoms[0].region): self.phantom_set.update(phantoms) return - + for region in self.view.sel(): line = self.view.line(region) (row, col) = self.view.rowcol(region.begin()) @@ -347,8 +347,9 @@ def on_modified_async(self): class InsertCommitDescriptionCommand(sublime_plugin.TextCommand): - def run(self, edit, desc): + def run(self, edit, desc, scratch_view_name): view = self.view view.set_scratch(True) view.set_syntax_file('Packages/Diff/Diff.sublime-syntax') view.insert(edit, 0, desc) + view.set_name(scratch_view_name)