Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Since release 1.21.0, switching notes results in a loss of focus of the editor #969

Closed
2 of 3 tasks
chrisgrieser opened this issue Dec 7, 2023 · 12 comments · Fixed by #972
Closed
2 of 3 tasks
Assignees
Labels
bug Something isn't working obsidian Obsidian specific syntax issue or feature reproducible resolution/update-made A change has been made that should resolve this issue or request

Comments

@chrisgrieser
Copy link
Contributor

  • I have verified that I am on the latest version of the Linter

Describe the Bug

Since release 1.21.0, switching notes results in a loss of focus of the editor. You need to click with the mouse into the editor to have it focussed again.

How to Reproduce

  1. open quick switcher
  2. switch to any other note
  3. try to move cursor with arrow keys, it won't work.

Testing with all plugins disabled other than linter. Only disabling/enabling linter changed that behavior. Rolling back to 1.20.1 fixes the issue.

Expected Behavior

No focus loss when switching notes

Device

  • Desktop
  • Mobile
@chrisgrieser chrisgrieser added the bug Something isn't working label Dec 7, 2023
@pjkaufman
Copy link
Collaborator

pjkaufman commented Dec 7, 2023

Hey @chrisgrieser , do you use custom commands? If so, this may be expected behavior since I have to open the file you were just in in order to run the custom commands against it.

Though this could be completely unrelated.

@pjkaufman
Copy link
Collaborator

Could you provide your data.json, so I can try to recreate the issue? Thanks!

@chrisgrieser
Copy link
Contributor Author

Yeah, I have a custom command added

@pjkaufman
Copy link
Collaborator

Yeah, I have a custom command added

I am not sure the Linter refocuses on the file you were just in after running the custom command. That is likely the problem, but I will have to test to be sure though. I am not sure why this would not happen in the prior version of the Linter.

@pjkaufman
Copy link
Collaborator

Here is my guess as to what is happening (I will have to test it later):
When you change files, the custom commands are triggered once the lint completes. This opens a new active window to lint the previous file with e custom commands (custom commands generally act on the currently active file, ao this has to happen for custom commands to work). Once it finishes, it does not properly set the focus back on the file you switched to.

Two things likely need to happen that currently probably do not:

  • disable lint on active file change while the Linter is changing the active file (should prevent any infinite loops so long as timing does not get messed up)
  • after running custom commands that required running in the sidebar, then set active file back to what it was before running the custom commands

This should tackle several of the problems.

@chrisgrieser
Copy link
Contributor Author

okay, I am back at the desk and have removed the custom command, and can confirm that it now works as it should

@pjkaufman
Copy link
Collaborator

okay, I am back at the desk and have removed the custom command, and can confirm that it now works as it should

Thanks for the update. I will have to see about fixing this.

@pjkaufman
Copy link
Collaborator

I can reproduce this scenario. I will have to see about fixing it to remember where to go back to once the custom command finishes for the custom commands that run in the side bar.

@pjkaufman pjkaufman added obsidian Obsidian specific syntax issue or feature reproducible labels Dec 9, 2023
@pjkaufman pjkaufman moved this to In Progress in Obsidian Linter Dec 9, 2023
@pjkaufman pjkaufman self-assigned this Dec 9, 2023
@pjkaufman
Copy link
Collaborator

I plan to tackle this one after the custom command issue for beautifying tables.

@pjkaufman
Copy link
Collaborator

Hey @chrisgrieser . I believe I have a fix for this issue. If you could test the attached main.zip. That would be great! I plan to fix one more thing after this before I make a release with the patches for the fixed bugs.

main.zip

@chrisgrieser
Copy link
Contributor Author

Can confirm, this fixes the issue. Many thanks for the quick fix! 😊

@pjkaufman
Copy link
Collaborator

This change has been merged into master. It should go out with the next release. Please let us know if there is an issue with this on master or in the next release.

@pjkaufman pjkaufman added the resolution/update-made A change has been made that should resolve this issue or request label Dec 10, 2023
@pjkaufman pjkaufman moved this from In Next Release to Released in Obsidian Linter Dec 13, 2023
@pjkaufman pjkaufman moved this from Released to Previous Release in Obsidian Linter Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working obsidian Obsidian specific syntax issue or feature reproducible resolution/update-made A change has been made that should resolve this issue or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants