No focus on file open behavior is happening again. This is after upgrade to the latest Sublime version 3033.
ST3: FuzzyFileNav
I am not sure how to fix this as of right now. I will look a little harder when I get some time, but Jon has really made this hard to get working proper on this latest release. I have no idea what he is doing in regards to this, but I cannot seem to get the view to focus on the quick panel selection event. It just won’t do it. I may have some other ideas, but I am going to wait until I have time.
Are you guys talking about when you open a View (window.open_file etc) then set some callback to alter selections when the file is loaded, the focus wandering off somewhere?
Yeah, the new open window just doesn’t have focus when the quick panel closes. Directly calling focus from the selection event doesn’t work, doing a set_timeout to call it recently doesn’t work. It is really just annoying more than anything. I haven’t really dug into finding a solution yet.
I don’t get where’s the problem is ?
If I run the plugin, select an unopened file and hit ESC, I have the focus on the beginning of the file.
Is it related to OS ?
startup, version: 3035 windows x64 channel: dev
Quite possibly related to OS.
I’m on linux usually. Will try now on this OSX [size=50]piece of crap[/size] wonderful device
Having same problems with my plugin on OSX [size=50]piece of crap[/size] device
Does the command you are referring to alter the selection in any way?
[quote=“castles_made_of_sand”]Having same problems with my plugin on OSX [size=50]piece of crap[/size] device
Does the command you are referring to alter the selection in any way?[/quote]
I only tried to reproduce the problem with FuzzyFileNav plugin, which run the following code:
# Open file
new_view = self.window.open_file(self.cls.cwd)
if new_view is not None:
self.window.focus_view(new_view)
So no the selection is not modified.
Sorry, I didn’t understand that it was related to the modifying selection.
Yeah, I don’t know, haven’t really followed this thread entirely.
My plugin I’m experiencing problems with navigates to a section in the file, making a new selection.
If FuzzyNav doesn’t alter selection ( why would it I guess ? ) and you are having focus problems, it could be due to layout split groups. If I recall correctly window.focus_view(v) only focuses a view in a given group, yet you still have to call window.focus_group(i)
Calling focus_group makes no difference.
The only way I have been able to get focus so far is to do something like this (which is horribly ugly):
[pre=#252525] multi = (
bool(sublime.load_settings(FUZZY_SETTINGS).get(“keep_panel_open_after_action”, False)) and
“open” not in sublime.load_settings(FUZZY_SETTINGS).get(“keep_panel_open_exceptions”, ])
)
new_view = self.window.open_file(self.cls.cwd)
if new_view is not None:
def fun(v, multi):
self.window.focus_view(v)
if not multi:
self.window.run_command(“show_panel”, {“panel”: “console”})
self.window.run_command(“hide_panel”, {“cancel”: True})
sublime.set_timeout(lambda: fun(new_view, multi), 500)
# sublime.set_timeout(lambda: self.window.focus_view(new_view), 500)[/pre]
I basically have to wait till the quick panel closes and then force a panel to open and close to trigger the refocusing…this is ugly and stupid. I shouldn’t have to do this kind of stuff.
lol, yeah I just got used to showing the goto line dialogue manually
I can live with hacky for an editor plugin I think I’ll do the same in mine for the moment.
Since I don’t want to mess with closing people’s output/console panels that are up, I found that opening and closing a quickpanel to be more acceptable and less intrusive:
[pre=#141414] def fun(v, multi):
v.window().focus_view(v)
if not multi:
v.window().show_quick_panel(“None”], None)
v.window().run_command(“hide_overlay”)
sublime.set_timeout(lambda: fun(new_view, multi), 500)[/pre]
It seems to have worked.
Do you monitor this thread manually? Is there any way to get an email alert when there is a new response?
Does the Sublime Text developer ever show up in these forums? It would be good to draw his attention to some of these niggling issues in new releases.
It looks like you’re on a coding spree again, so I’ve come out of the woodwork to ask again:
Any chance of implementing a “proper” save? By which I mean using FuzzyFileNav instead of my OSs “Save As…” dialog.
Alex
@quodlibet, yeah, I am on a bit of a coding spree. Squashing a couple of bugs here and there, and pushing out some personal plugins that have been sitting in my settings folder (at least the stable ones).
As for your “Save As…” request, I will take a look again. If I do it, it can’t replace the built-in save completely, and it may not work with on save, pre-save events. I need to dig into it again. I have a couple of bugs and features that are on my list to get done before I burn out, so we shall see what I get to .
For the record, this is what I have in mind:
- Save
- If saved, save.
- If unsaved, popup FuzzyNav, filled in with contents of first line (up to a certain number of characters, probably) + default syntax extension (if other than Plain Text)
- Save As
- Popup FuzzyNav, filled in with current name, or as above if unsaved
This seems to cover most cases (?). (Or maybe not. It’s a little late and I’m not thinking all that clearly.)
The above setup seems feasible to me if you provide new commands to bind Ctrl+S and Ctrl+Shift+S to. Or perhaps you can interfere with on_command with some setting to toggle it?
I’m not sure how you’d handle the “current directory” for unsaved files. Sublime uses the directory of the file from which you opened the new file/tab (I think.) Is this information available for you to use? Opening FuzzyNav on an unsaved file is a always a little surprising.
Something else: Is there a binding I can set to open multiple files? I mean regardless of the keep_panel_open_exceptions setting. I’d like to set Alt+Right (or something) to open a file without closing FuzzyNav, mimicking the palette’s right arrow functionality.
Alex
Edit: would you prefer these in GH’s issues?
Github issues are more likely to prompt me to do something. I say things in this forum that I often forget.
I honestly approach issues with no pressure. I haven’t cracked down and disabled filing issues to encourage pull requests, but I basically approach it by leaving issues open that I think I might do one day…and one day if I feel like it, and no one else has opted to do it for me, I do it . Github issues helps me remember what issues or requests I haven’t turned down…sometimes I go dark for months at a time, and when I poke my head out again, I barely remember what it is I was going to do.
FuzzyFileNav will now display the current working directory in the status bar as long as the quick panel is open. A number of people have complained they get lost when navigating, this should now allow everyone to always know where they are at .