Sublime Forum

How to do the `jump_back` command from find panel?

#1

How to do the jump_back command from find panel?

When I the jump_back command on the find panel, it is trying to do it there, not in my view.
This is very annoying because several times I am searching and I want to go back with alt+left, it it does nothing, neither on the find panel or in my view. However the debugging on the console shows that the command is being performed.

    { "keys": ["alt+left"], "command": "jump_back" },

    { "keys": ["alt+left"], "command": "jump_back", "context":
        [
            { "key": "setting.is_widget", "operator": "equal", "operand": true }
        ]
    },

Console output:

command: drag_select {"event": {"button": 1, "x": 482.5, "y": 963.5}}
command: drag_select {"event": {"button": 1, "x": 767.5, "y": 232.5}}
key evt: alt+left
command: jump_back
key evt: control+f
command: show_panel {"panel": "find", "reverse": false}
key evt: alt+left
command: jump_back
key evt: alt+left
command: jump_back
key evt: alt+left
command: jump_back
key evt: alt+left
command: jump_back
key evt: control+`
command: show_panel {"panel": "console", "toggle": true}
0 Likes

#2

write your own command to execute jump_back on the main view and update your keybindings to use that?

3 Likes

#3

Thanks, It is working, but the caret is hidden:


import sublime
import sublime_plugin



class MyJumpBackCommand(sublime_plugin.TextCommand):

    def run(self, edit):

        print( 'Calling MyJumpBackCommand...' )
        sublime.active_window().active_view().run_command("jump_back")

I tried the bug fix:

  1. Running "goto_row_col" command in custom plugin

But is not working here:

import sublime
import sublime_plugin



class MyJumpBackCommand(sublime_plugin.TextCommand):

    def run(self, edit):

        print( 'Calling MyJumpBackCommand...' )
        view = sublime.active_window().active_view()

        bug = [s for s in view.sel()];
        view.add_regions("bug", bug, "bug", "dot", sublime.HIDDEN | sublime.PERSISTENT);
        view.erase_regions("bug");

        view.run_command("jump_back")
0 Likes

#4

the caret in the main view is always hidden when the find panel (or indeed any panel) has the focus, I don’t know if it’s possible to change that…

2 Likes