obsidian-remember-cursor-position
obsidian-remember-cursor-position copied to clipboard
fix: Do not jump the cursor when having documents already open
I am using this fix locally for Issue #54, but am looking for a better fix.
The outline is as follows.
- Get a combined string of id and filename in a list for all opened leafs.
- If a newly activated leaf is included in the list, abort the process.
However, id property is not exposed.
https://docs.obsidian.md/Reference/TypeScript+API/WorkspaceLeaf
I look forward to better suggestions from contributors.
This looks pretty smart. Thank you for your effort! I'm not familiar enough with the API to add more functional input I'm afraid. But am I correct that file-open is the event that is triggered for both the first opening of a file and focussing a file (in a pane)?
Does the event not bring any meta data to the context of event? Seems like there should be some way to abort based on that. The documentation doesn't actually document that much it looks like :/
Can I merge this fix if there is no better solution?
@SerafinDinges Thank you. I have looked for the metadata you suggested but could not find it.
@dy-sh
Perhaps the current implementation will cause minor unintended behavior due to this.lastLoadedFileName not being updated. I have looked for a workaround, but it seems to be difficult to find right away.
In response to the discussion in Issue #54, I removed the Draft notation. Please merge if you are okay with this.
Merged. Thank you for the fix!
Tested it in 1.0.9 and it appears to be working.
- Side by Side on the same document (and different scroll positions) ✅
- Side by Side with different documents ✅
- Opening the same document in multiple tabs ✅
Great work and so happy that this is now integrated. I had disabled this plugin because of this missing.
Yes really appreciate the effort. Thank you so much!