TheSpyder / SyncedSideBar

Sublime Text plugin to sync project sidebar (folder view) with currently active file.
341 stars 23 forks source link

The package steals focus from input in Goto Anything and Command Palette in ST4 #53

Closed kapooostin closed 4 years ago

kapooostin commented 4 years ago

Sublime Text 4056 macos 10.14.6

When a palette shows up the cursor in its input is shown for a brief moment and then it disappears. Where is it I cannot tell, when I type nothing changes in the app. Up and down arrows still move focus in the palette's list of items.

TheSpyder commented 4 years ago

Sublime Text 4? I didn't know that was in progress. I also can't find any reference to it. Can you please send me a link?

This package does trigger commands when the focus changes, so if the API has changed I'm not surprised this package breaks things.

kapooostin commented 4 years ago

So did I, until I met a bug report from it on the forum. The developers publish it on Sublime Discord server https://discord.gg/D43Pecu.

Sorry I won't publish download links here as they wanted to keep the user base manageable while this app version is still in its early stage.

TheSpyder commented 4 years ago

Oh totally understandable! My email address is public on my profile, but I'll jump in Discord and see about getting a link there. I hadn't heard about the Discord server either :)

andremacola commented 4 years ago

Will be any update on this?

TheSpyder commented 4 years ago

Sorry, I've been busy and haven't had a chance to try ST4 yet. I did join the Discord.

andremacola commented 4 years ago

I created a pull request to fix this problem. I would appreciate it if you could test and publish it on Package Control

TheSpyder commented 4 years ago

Thank you for that! I've had a lot going on with coronavirus-related changes so while I've installed many builds of ST4, I haven't had time to investigate API changes.

I'll test your patch this week.

andremacola commented 4 years ago

Ok, there is still a problem, in some situations the focus on the file is lost and remains in the sidebar until you select the file again.

This problem existed before, this is how reveal_in_side_bar works.

What I'm doing at the moment is using win.run_command('focus_group', "args": { "group": 1 }) after reveal_in_side_bar. It's not the most elegant way but it works

Edit: Forget it, this method does not work with multiple layout columns. But, the command palette problem is fixed

TheSpyder commented 4 years ago

reveal_in_side_bar didn't take focus previously iirc, maybe that's a ST4 bug?

andremacola commented 4 years ago

@TheSpyder I updated the PR with some improvements.

I created a focus-on-view settings (default: true), this fix the problem I mentioned.

And I think it is working with multiple columns/layouts too.

So command palette and the focus problem is now fixed.

TheSpyder commented 4 years ago

I confirmed reveal_in_side_bar doesn't force focus in ST3, but applying the focus_view() fix to ST3 didn't break anything so it seems safe to always do it.

andremacola commented 4 years ago

Yes, but it is needed for ST4. At least for now.

Just to recap, there is two fixes: