Skip to content

Preserve scroll position when switching documents - #976

Open
Johan Andersson (johandersson) wants to merge 1 commit into
microsoft:mainfrom
johandersson:fix/586-document-scroll-position
Open

Johan Andersson (johandersson) wants to merge 1 commit into
microsoft:mainfrom
johandersson:fix/586-document-scroll-position

Conversation

@johandersson

Copy link
Copy Markdown

Keep textarea viewport state per text buffer so switching documents neither transfers the active document's scroll offset nor loses each document's previous position. Stale viewport entries use weak references and are removed after their buffers are closed.

Adds a regression test covering independent scroll positions across repeated document switches.

Fixes #586

Testing:

  • cargo test -p edit --lib
  • cargo clippy -p edit --lib --tests -- -D warnings
  • rustfmt --edition 2024 --check --config newline_style=Native crates/edit/src/tui.rs

@johandersson

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Previous scroll position lost when switching documents

1 participant