On pane resize, center text wrapping around the current cursor position

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

2 posts were merged into an existing topic: Changing window size should keep the cursor in view