[BUG] Previous scroll position lost when switching documents
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 14.6k
- Forks
- 734
- Avg merge
- 8h 40m
- Merged PRs (30d)
- 4
Description
Hello! Firstly, thank you to all who have worked on this editor. I would like to report a UX issue so it can be even better. I'm unsure if this is better considered a bug or feature request, so I apologize if the title is incorrect. However, from the user perspective this seems like a bug.
When switching between two open documents (e.g. when using `Ctrl+P`), the scroll position of the document you were just viewing transfers to the new document. This causes you to visually lose your place, particularly when jumping between documents in which you have (had) drastically different scroll positions. For example, if you are editing the bottom of one document, then switch to another document and edit at the top, when you return to the first document it will be scrolled to the top and you will need to manually move the scroll to see the bottom again. The same thing also happens with the horizontal scroll. Please see below for a demonstration.
In this situation, the only way to quickly regain your position seems to be to manipulate the cursor. However, this is still undesirable as it requires the cursor to be at the place you were scrolled to (likely, but not always the case), messes with your selection if you had one, and if you had the document scrolled a particular way (e.g. to have a particular set of lines in view) then this still cannot quickly be fixed.
Please see the following for a demonstration. Thanks.
https://github.com/user-attachments/assets/757504ff-a5db-44a2-865f-44971d204ef5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with two open documents, using Ctrl+P to switch between documents with different vertical and horizontal scroll positions. Trace the document-switching behavior and identify where scroll state is handled; done means each document restores its own vertical and horizontal positions when revisited.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100