Skip to content

Commit

Permalink
Merge pull request #1139 from divmain/navigate_show_at_center
Browse files Browse the repository at this point in the history
Sometimes navigation scrolls to the right
  • Loading branch information
stoivo committed Jul 6, 2019
2 parents 3f8dc3d + bffa311 commit 6d402de
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/commands/navigate.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ def run(self, edit, forward=True):
# Position the cursor at the beginning of the file name.
new_position += self.offset
sel.add(sublime.Region(new_position, new_position))
self.view.run_command("show_at_center")
self.view.show_at_center(new_position)

# The following shouldn't strictly be necessary, but Sublime sometimes
# jumps to the right when show_at_center for a column-zero-point occurs.
_, vp_y = self.view.viewport_position()
self.view.set_viewport_position((0, vp_y), False)

def forward(self, current_position, file_regions):
for file_region in file_regions:
Expand Down

0 comments on commit 6d402de

Please sign in to comment.