Skip to content

Commit

Permalink
Drop JumpBack command
Browse files Browse the repository at this point in the history
Obsolete as of ST3.

Key bindings are re-mapped to built-in `jump_prev`.

Mouse binding is dropped as conflicting with built-in block selection binding.
  • Loading branch information
deathaxe committed Jan 12, 2024
1 parent 2d1347f commit 03c0d17
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 65 deletions.
5 changes: 0 additions & 5 deletions Context.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@
"caption": "Navigate to Definition",
"command": "navigate_to_definition",
"args": {}
},
{
"caption": "Jump Back",
"command": "jump_prev",
"args": {}
}
]
4 changes: 2 additions & 2 deletions Default.sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"keys": ["ctrl+t", "ctrl+y"]
},
{
"command": "jump_prev",
"command": "jump_back",
"keys": ["ctrl+t", "ctrl+b"]
},
{
"command": "jump_prev",
"command": "jump_back",
"keys": ["ctrl+shift+comma"]
},
{
Expand Down
12 changes: 6 additions & 6 deletions Default.sublime-mousemap
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"modifiers": ["ctrl", "shift"],
"command": "navigate_to_definition"
},
{
"button": "button2",
"count": 1,
"modifiers": ["ctrl", "shift"],
"command": "jump_prev"
}
// {
// "button": "button2",
// "count": 1,
// "modifiers": ["ctrl", "shift"],
// "command": "jump_back"
// }
]
1 change: 0 additions & 1 deletion plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
# Publish Commands and EventListeners
from .plugins.cmds import (
CTagsAutoComplete,
JumpPrev,
NavigateToDefinition,
RebuildTags,
SearchForDefinition,
Expand Down
52 changes: 1 addition & 51 deletions plugins/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import subprocess
import threading

from collections import defaultdict, deque
from collections import defaultdict
from itertools import chain
from operator import itemgetter as iget

Expand Down Expand Up @@ -448,54 +448,6 @@ def get_current_file_suffix(path):
return file_suffix


#
# Sublime Commands
#

# JumpPrev Commands


class JumpPrev(sublime_plugin.WindowCommand):
"""
Provide ``jump_back`` command.
Command "jumps back" to the previous code point before a tag was navigated
or "jumped" to.
This is functionality supported natively by ST3 but not by ST2. It is
therefore included for legacy purposes.
"""

buf = deque(maxlen=100) # virtually a "ring buffer"

def is_enabled(self):
# disable if nothing in the buffer
return len(self.buf) > 0

def is_visible(self):
return setting("show_context_menus")

def run(self):
if not self.buf:
return status_message("JumpPrev buffer empty")

file_name, sel = self.buf.pop()
self.jump(file_name, sel)

def jump(self, path, sel):
@on_load(path, begin_edit=True)
def and_then(view):
select(view, sel)

@classmethod
def append(cls, view):
"""Append a code point to the list"""
name = view.file_name()
if name:
sel = [s for s in view.sel()][0]
cls.buf.append((name, sel))


# CTags commands


Expand Down Expand Up @@ -562,7 +514,6 @@ def show_tag_panel(view, result, jump_directly):

def on_select(i):
if i != -1:
JumpPrev.append(view)
# Work around bug in ST3 where the quick panel keeps focus after
# selecting an entry.
# See https://github.com/SublimeText/Issues/issues/39
Expand Down Expand Up @@ -632,7 +583,6 @@ def run(symbol, region, sym_line, mbrParts, view, tags_file):

if not tags:
# append to allow jump back to work
JumpPrev.append(view)
view.window().run_command("goto_definition")
return status_message('Can\'t find "%s"' % symbol)

Expand Down

0 comments on commit 03c0d17

Please sign in to comment.