From 03c0d1751cdc92b40a7b639ab241f519c24f4da8 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Fri, 12 Jan 2024 18:58:31 +0100 Subject: [PATCH] Drop JumpBack command 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. --- Context.sublime-menu | 5 ---- Default.sublime-keymap | 4 ++-- Default.sublime-mousemap | 12 +++++----- plugin.py | 1 - plugins/cmds.py | 52 +--------------------------------------- 5 files changed, 9 insertions(+), 65 deletions(-) diff --git a/Context.sublime-menu b/Context.sublime-menu index 0bd17ef..e825417 100644 --- a/Context.sublime-menu +++ b/Context.sublime-menu @@ -6,10 +6,5 @@ "caption": "Navigate to Definition", "command": "navigate_to_definition", "args": {} - }, - { - "caption": "Jump Back", - "command": "jump_prev", - "args": {} } ] diff --git a/Default.sublime-keymap b/Default.sublime-keymap index 1086006..c2db4c2 100644 --- a/Default.sublime-keymap +++ b/Default.sublime-keymap @@ -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"] }, { diff --git a/Default.sublime-mousemap b/Default.sublime-mousemap index a069a4b..ccaa81b 100644 --- a/Default.sublime-mousemap +++ b/Default.sublime-mousemap @@ -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" + // } ] \ No newline at end of file diff --git a/plugin.py b/plugin.py index 1be5085..204bba4 100644 --- a/plugin.py +++ b/plugin.py @@ -23,7 +23,6 @@ # Publish Commands and EventListeners from .plugins.cmds import ( CTagsAutoComplete, - JumpPrev, NavigateToDefinition, RebuildTags, SearchForDefinition, diff --git a/plugins/cmds.py b/plugins/cmds.py index a02fcc0..0036347 100644 --- a/plugins/cmds.py +++ b/plugins/cmds.py @@ -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 @@ -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 @@ -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 @@ -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)