Keep the cursor / current line in view while resizing (or at least the top of the document)

Steps to reproduce

  1. Find a few notes that are long enough that you’d have to scroll to the bottom even if it was the only Note on screen.
  2. Open up those few Notes in Edit mode with the typical vertial divisions.
  3. Place your cursor somewhere midway down the page.
  4. Start resizing some of the windows with vertical border handle.

Expected result

  • It seems we should be able to resize a window and get right back to to where we left our cursor and start typing.
  • My ideal would be that the cursor remains steady in place while the windo is resized. The cursor should be the scroll position reference point.
  • Put another way, if our cursor is visible when scroll position is at 50% and the window is then narrowed by half, the new scroll position should automatically adjust to around 25% to keep the cursor in view.

Actual result

  • The wondows scroll moniacly :wink: when their width is resized, making it difficult to figure out where you were before.

Environment

  • Operating system: win
  • Obsidian version: 064
  • Using custom CSS: just color and font changes

Additional information

1 Like

Ok I can replicate, it doesn’t seem a huge deal but I see your point. Moved to feature request.

A post was split to a new topic: Resizing pane causes the editor cursor to disappear/lose focus

I agree that loosing focus on resize is annoying. Moving that to BR.
The issue that you described in the first post is more subtle and has to do with reflowing the document while maintaining the current line in view. I edited the title to make it clearer.

1 Like

Use case or problem

I’ve got two documents open side-by-side. The first contains some “literature notes” - mostly just important ideas and quotes from a book. The second is a document where I’m pulling out and summarizing elements from the first document. So my workflow is scrolling down document 1 until I find something interesting and then I move to document 2 to write some thoughts about document 1. I’m working my way down.

Every so often I come across a new idea that needs its own note - a detour from my workflow. So I open a new document - document 3 - to the right of document 2. This causes the scroll positions in the first documents to change in ways I don’t understand but basically I’ve completely lost my context. I write my notes in document 3 and then Ctrl+W to close that document when I’m done with it. Now the scroll positions in my main two documents are now completely messed up - definitely not where I left them before I opened document 3. It is very very confusing. I scroll up and down in each of those documents until I can find the last place I was working.

A simpler example is to just open a document. Then open a side panel - this will cause the text in the main panel to scroll into a different place - and I find this quite jarring.

Proposed solution

I’m not sure exactly. I think this is a tricky problem. Should you preserve the scroll position? Cursor visibility? Should it work differently in preview vs. edit mode?

My initial suggestion is that the top-most visible text in the window should stay exactly where it is when a window is resized. So if the first visible text in a window is “The cat in the hat”, then when you resize the window that same sentence should be visible at the very top. This preserves some kind of context and I suspect it will be the least visually jarring/confusing option because at least something in the original windows will stay exactly where it was before. Otherwise the text jumps up and out of view or below and out of view and you don’t understand what happened.

I played around in VS Code a bit and think it works this way. If you open a text document and scroll down, and then Ctrl+B to open or close the side bar, the main document scroll position is completely unchanged.

Microsoft word does what I want. If you put a bunch of text in a document and then resize the Word window to make it very narrow, the text at the top of the document does not move at all. Text at the bottom may move down and no longer be visible, which is fine.

I looked at how the web browser handles this. Just open a page on Amazon, scroll down a bit, and then resize the browser window to make it more or less narrow - the text at the very top always stays exactly where it is.

I now this is actually a bug, not a feature request. The current behavior is very jarring.

Current workaround (optional)

After each new document is opened or closed, scroll in the other documents until I find where I was.

I tried opening a new document OVER one of the previous two side-by-side ones but this didn’t work since when I was done, if I do Ctrl+W it closes what I was originally working on too.

Related feature requests (optional)

Might be related to Changing window size should keep the cursor in view - #3 by goodsignal

3 Likes

I added more comments to the original FR.

I agree with @jmagaram that this is a bug. I have exactly the same problem (Windows v0.12.12): I have two or three long notes open, and whenever I open a new one the other notes are resized (becoming narrower). And then I need to scroll up and down to find the place where I was in my original notes. Have to say that I really like Obsidian, but this issue really impacts my usage.

I also like @jmagaram 's suggestion that the top-most visible text should stay where it is when a window is resized. Another possibility would be that the text in the ‘middle’ of the window stays where it is.

2 Likes

I don’t know what’s the proper way to do this on this forum, but could ‘keep the cursor in view while resizing’ be moved to #bug-reports? Or shall I create a new bug report over there which links to this feature request? Don’t know what’s the proper way to do this on this forum.

Thanks in advance. And I do hope it can be fixed.

No, Keep it here. This is a feature to implement.

1 Like