Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Origami.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
// fraction of the screen, such as "0.75", or "[0.5, 0.6]" for
// horizontal and vertical correspondingly.
"auto_zoom_on_focus": false,


// Automatically focus a pane when View.on_hover event.
"auto_focus_on_hover": false,

// Automatically close a pane once you've closed the last file in it.
"auto_close_empty_panes": false,

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ You can have Origami automatically zoom the active pane by setting `auto_zoom_on

Origami can also automatically close a pane for you once you've closed the last file in it. Just set `auto_close_empty_panes` to true in the Origami preferences.

if you want to activate a pane when mouse on hover event, set `auto_focus_on_hover` to true in the Origami preferences.

Installation
------------

Expand Down
27 changes: 27 additions & 0 deletions origami.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,3 +835,30 @@ def on_activated(self, view):
self.running = True

sublime.set_timeout(lambda: self.delayed_zoom(view, fraction), 0)


class TravelToPaneOnMoveCommand(sublime_plugin.EventListener, WithSettings):

# I know there is Command.want_event can trigger some input function when mouse action.
# But there any sublime callback like on_mouse_move?
# View.on_hover Event callback
# this callback receive a view reference, and a text point (text length),
# which can be conver to window position like this below:
# view.text_to_window(txtpoint)
# hover_zone enum defined sublime.HoverZone under sublime Python 3.8
#
# Add .python-version to support newest ST4 #174
# https://www.sublimetext.com/docs/api_environments.html#python-version
# print({"sys.version": sys.version})
def on_hover(self, view, txtpoint, hover_zone):

if not self.settings().get("auto_focus_on_hover") :
# or view.settings().get("origami_auto_focus_on_hover")
return

try:
window = sublime.active_window()
window.focus_view(view)
except Exception as ex:
zones = ['TEXT', 'GUTTER', 'MARGIN']
print("on_hover error=>", ex, {"point": txtpoint, "hover_zone": zones[hover_zone-1]})