@@ -255,29 +255,30 @@ def show_done(self, result):
255
255
class GitGotoCommit (GitTextCommand ):
256
256
def run (self , edit ):
257
257
view = self .view
258
- selection = view .sel ()[0 ]
259
- if not (
260
- self .view .match_selector (selection .a , "text.git-blame" )
261
- or self .view .match_selector (selection .a , "text.git-graph" )
262
- ):
263
- return
264
258
265
259
# Sublime is missing a "find scope in region" API, so we piece one together here:
266
- line = view .line (view .sel ()[ 0 ]. a )
260
+ lines = [ view .line (sel . a ) for sel in view .sel ()]
267
261
hashes = self .view .find_by_selector ("string.sha" )
268
- commit = False
262
+ commits = []
269
263
for region in hashes :
270
- if line .contains (region ):
271
- commit = view .substr (region )
272
- break
273
- if not commit or commit .strip ("0" ) == "" :
274
- return
264
+ for line in lines :
265
+ if line .contains (region ):
266
+ commit = view .substr (region )
267
+ if commit .strip ("0" ):
268
+ commits .append (commit )
269
+ break
270
+
275
271
working_dir = view .settings ().get ("git_root_dir" )
276
- self .run_command (['git' , 'show' , commit ], self .show_done , working_dir = working_dir )
272
+ for commit in commits :
273
+ self .run_command (['git' , 'show' , commit ], self .show_done , working_dir = working_dir )
277
274
278
275
def show_done (self , result ):
279
276
self .scratch (result , title = "Git Commit View" ,
280
277
syntax = plugin_file ("syntax/Git Commit View.tmLanguage" ))
281
278
282
279
def is_enabled (self ):
283
- return True
280
+ selection = self .view .sel ()[0 ]
281
+ return (
282
+ self .view .match_selector (selection .a , "text.git-blame" )
283
+ or self .view .match_selector (selection .a , "text.git-graph" )
284
+ )
0 commit comments