Skip to content

Reopening a file puts me back where I was in it - #514

Merged
jamescrosswell merged 1 commit into
mainfrom
feat/remember-position
Oct 12, 2026
Merged

jamescrosswell merged 1 commit into
mainfrom
feat/remember-position

Conversation

@a-team-app

@a-team-app a-team-app Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Opening a file now puts you back where you last were in it: the same cursor line and column, scrolled the same way. That holds for tabs restored with a folder (after Ctrl+Q, or switching with or), for every restored tab, not just the active one, and for a file closed and reopened from the Explorer or quick open. It's remembered per file path, so the same file reached from another folder comes back at the same place.

Anything that opens a file at a place still goes there: a Find result, Go to definition, Usages, Back / Forward, Enter in a diff, tuicode file:42. A file that got shorter lands on its nearest line. Commit messages and rebase todos (anything inside .git) always open at the top.

Closes #502

Notes

  • Positions live in their own file, ~/.tui/TuiCode.positions.json, capped at the 300 most recently used files. They're written when a tab closes, before a folder switch and on quit, never per keystroke.
  • A wrapped tab restores the file line at the top. If the top screen row was the continuation of a wrapped line, it comes back with that whole line in view, a few rows higher than before.

a-team try tuicode 514

FilePositionStore keeps each file's cursor and top line in
~/.tui/TuiCode.positions.json, keyed by full path across folders, most
recently used first and capped at 300; files inside .git are never kept.
Workbench records a tab's position as it closes, every tab's before a
folder switch and on quit, and hands it back as a file's tab is created,
before it's added. Anything that opens at a place moves the cursor
afterwards, which drops the remembered scroll, so it still wins.

The scroll waits for the tab's first draw: before that TG hasn't sized
the content to the text, so the viewport can't move past the first
screen.

Closes #502

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@a-team-app
a-team-app Bot marked this pull request as ready for review October 11, 2026 11:27
@jamescrosswell
jamescrosswell merged commit 6532bb7 into main Oct 12, 2026
30 checks passed
@jamescrosswell
jamescrosswell deleted the feat/remember-position branch October 12, 2026 03:22
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.

Reopening a file puts me back where I was in it

1 participant