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

Bug: reading mode editor de-selected after "lint on file change" #1041

Open
2 of 3 tasks
prettyfaroutman opened this issue Mar 13, 2024 · 5 comments
Open
2 of 3 tasks
Labels
bug Something isn't working obsidian Obsidian specific syntax issue or feature

Comments

@prettyfaroutman
Copy link

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

Describe the Bug

With the "lint on file change" option selected, when I click on a tab that is already in reading mode, it almost immediately de-selects. I discovered this because the keyboard shortcut to switch between editing and reading mode doesn't work in these cases.

How to Reproduce

Steps to reproduce the behavior:

  1. turn on "lint on file change"
  2. navigate to a new tab that is currently in reading mode

I am not a coder so I was not able to figure out how to capture logs, but this is the config file:

data.json

Expected Behavior

The editor should be selected after clicking on its tab.

Device

  • Desktop
  • Mobile
@prettyfaroutman prettyfaroutman added the bug Something isn't working label Mar 13, 2024
@pjkaufman
Copy link
Collaborator

Hey @prettyfaroutman , thanks for opening up an issue and including your config values.
Could you elaborate on what you mean here? I think you are saying that if you have lint on file change enabled and you swap to a file that is in reading mode, it lints the previous file, but when it returns to the file that was in reading mode it is no longer in reading mode. Is that correct, or did I misunderstand?

@prettyfaroutman
Copy link
Author

Hey @prettyfaroutman , thanks for opening up an issue and including your config values. Could you elaborate on what you mean here? I think you are saying that if you have lint on file change enabled and you swap to a file that is in reading mode, it lints the previous file, but when it returns to the file that was in reading mode it is no longer in reading mode. Is that correct, or did I misunderstand?

It is different than that - sorry I was unclear! I will try to explain the best I can. The behavior that I expect when I navigate to a tab (any tab) is that I will be able to interact with the info on that tab without any more mouse clicks. So for example, I expect to be able to use keyboard shortcuts to flip between reading and editing mode, to view properties, to search the note, etc. When the tab that I select is in editing mode, this all seems to work fine. But if the tab I switch to is in reading mode, I can no longer interact with the note until I click inside it again. I'm not sure if there is an element that is in focus, but the tab I've switched to is not. The title in the tab is also not highlighted. Below I've included a screenshot of the tab while editing and interacting with it, and then a screenshot of what happens when I leave it in reading mode, switch away, and then switch back.
Screen Shot 2024-03-13 at 9 25 PM
Screen Shot 2024-03-13 at 9 26 PM

I presume that it's linting the file on switch? I don't have any issues with the way the linter is working. The only reason I know it has something to do with "lint on file change" is that if I turn that off, the behavior no longer happens.

Does this clarify the issue?

@pjkaufman
Copy link
Collaborator

That makes sense. This is probably going to take a while to fix. This is mainly because Lint on File Change only keeps track of the file names to navigate to. So if there are two of the same note open, it may not work as expected. I will have to see about taking a look into this.

@prettyfaroutman
Copy link
Author

prettyfaroutman commented Mar 14, 2024

I think I still wasn't fully clear 😅 I'm not saying I have two instances of the same note open. Let's say I have two tabs open, one with yesterday's daily note and one with today's. I'm editing today's, and then I switch to reading mode before navigating to yesterday's. Yesterday's note was still in edit mode, so everything works as expected. But when I navigate back to today's, which I left in reading mode, that is when I have to reclick.

I'm not sure whether that makes it easier or harder to fix, but I hope it makes more sense at least!

@pjkaufman
Copy link
Collaborator

That might be easier to fix, but I am not sure why that would happen since I am not altering the mode it is in. But maybe it is just a quirk of updating the editor in reading mode.

@pjkaufman pjkaufman added the obsidian Obsidian specific syntax issue or feature label Apr 26, 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
Projects
None yet
Development

No branches or pull requests

2 participants