Skip to content

Commit

Permalink
Fix jump error when exiting char mode without entering target
Browse files Browse the repository at this point in the history
  • Loading branch information
bismarck2100 committed Nov 16, 2016
1 parent 415df6f commit 1cbe220
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 1cbe220

Please sign in to comment.