1414
1515class  BlameShowAll (BaseBlame , sublime_plugin .TextCommand ):
1616
17+  HORIZONTAL_SCROLL_DELAY_MS  =  100 
18+ 1719 # Overrides -------------------------------------------------- 
1820
1921 def  __init__ (self , view ):
@@ -34,6 +36,9 @@ def run(self, edit):
3436 self .phantom_set .update (phantoms )
3537 self .view .settings ().erase (VIEW_SETTING_PHANTOM_ALL_DISPLAYED )
3638 self .view .run_command ("blame_restore_rulers" )
39+  # Workaround a visible empty space sometimes remaining in the viewport. 
40+  self .horizontal_scroll_to_limit (left = False )
41+  self .horizontal_scroll_to_limit (left = True )
3742 return 
3843
3944 try :
@@ -75,12 +80,7 @@ def run(self, edit):
7580 self .view .settings ().set (VIEW_SETTING_PHANTOM_ALL_DISPLAYED , True )
7681 self .store_rulers ()
7782 # Bring the phantoms into view without the user needing to manually scroll left. 
78-  sublime .set_timeout (
79-  lambda : self .view .set_viewport_position (
80-  (0.0 , self .view .viewport_position ()[1 ])
81-  ),
82-  0 ,
83-  )
83+  self .horizontal_scroll_to_limit (left = True )
8484
8585 def  _view (self ):
8686 return  self .view 
@@ -104,6 +104,15 @@ def store_rulers(self):
104104 )
105105 self .view .settings ().set (VIEW_SETTING_RULERS , [])
106106
107+  def  horizontal_scroll_to_limit (self , * , left ):
108+  x  =  0.0  if  left  else  self .view .layout_extent ()[0 ]
109+  y  =  self .view .viewport_position ()[1 ]
110+  # NOTE: The scrolling doesn't seem to work if called inline (or with a 0ms timeout). 
111+  sublime .set_timeout (
112+  lambda : self .view .set_viewport_position ((x , y )),
113+  self .HORIZONTAL_SCROLL_DELAY_MS ,
114+  )
115+ 107116
108117class  BlameEraseAll (sublime_plugin .TextCommand ):
109118
0 commit comments