Skip to content

Commit

Permalink
Merge pull request #53 from bismarck2100/patch-1
Browse files Browse the repository at this point in the history
Fix jump error when exiting char mode without entering target
  • Loading branch information
ice9js authored Nov 16, 2016
2 parents 415df6f + 1cbe220 commit bc18fec
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ace_jump.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ def submit(self):
self.remove_labels()
set_views_sel(self.all_views, self.sel)
set_views_syntax(self.all_views, self.syntax)
self.jump(self.labels.find(self.target))

if self.valid_target(self.target):
self.jump(self.labels.find(self.target))

mode = 0
ace_jump_active = False
Expand Down Expand Up @@ -209,8 +211,6 @@ def remove_labels(self):

def jump(self, index):
"""Performs the jump action"""
if self.target == "" or index < 0 or index >= last_index:
return

region = hints[index].begin()
view = self.changed_views[self.view_for_index(index)]
Expand All @@ -234,6 +234,13 @@ def view_for_index(self, index):
if index < breakpoint:
return self.breakpoints.index(breakpoint)

def valid_target(self, target):
"""Check if jump target is valid"""

index = self.labels.find(target)

return target != "" and index >= 0 and index < last_index;

class AceJumpWordCommand(AceJumpCommand):
"""Specialized command for word-mode"""

Expand Down

0 comments on commit bc18fec

Please sign in to comment.