Repository navigation
Reopening a file puts me back where I was in it #502
Copy link
Copy link
Closed
Labels
a-team:devClaimed by the a-team DevClaimed by the a-team Dev
Description
Context
Opening a file today always lands on line 1, whether it's a tab restored with its folder or a file closed and reopened minutes ago. This task makes TuiCode remember where you were in each file (cursor and scroll) and put you back there whenever a file opens without a place of its own to go to. Pitch: #217.
Prerequisite: #460 (second editor group) should merge first; it reworks the same open paths in Workbench.
Acceptance criteria
- Quit TuiCode (
Ctrl+Q) with the cursor partway down a long file, then runtuicodeon the same folder again: that tab opens with the cursor on the same line and column, scrolled the same way, and the status bar shows thatLn, Col. - Every restored tab comes back at its own position, not just the active one: switching to another restored tab shows where you were in that one.
- Close a tab, then reopen the file from the Explorer or quick open: it opens where you left it.
- Switch folders with Open recent folder (
or) and back: each folder's tabs come back at their positions. - A file reached from a different folder (same path on disk) opens where you last were in it.
- Opening a file at a place still goes to that place, not the remembered one: a Find in files result, Go to definition, Usages, Go to line (
gl),Enterin a diff, Back / Forward (gp/gn). - If the file got shorter since (e.g. after a
git checkout), the cursor lands on the nearest line that still exists, and nothing errors. - A commit message or rebase todo that git hands TuiCode (anything inside
.git) always opens at the top. - Diff and Review tabs behave as they do today.
Tests
- The position store: save and load per file path, most-recently-used ordering, the cap on how many files it keeps (a few hundred), surviving a missing or corrupt file the way
WorkspaceStateStoredoes, paths inside.gitnever recorded. - The position is recorded on tab close, on folder change and on quit, and not on every keystroke.
- Opening without a target restores the position; opening with a target (each of the paths in the criteria) ignores it.
- Clamping when the remembered line or column is past the end of the file.
- Update the
AGENTS.mdnote on workspace state that says cursor positions aren't persisted yet.
Out of scope
- Selections, multiple carets, word wrap or other per-tab view toggles: only the primary cursor and scroll.
- A Reopen closed tab command (I close a tab and want it straight back, but I have to find the file and my place in it again #343).
- Persisting Back / Forward history across restarts.
- Unsaved edits across a restart (hot exit).
- A setting to turn it off.
- Tracking where text moved when the file changed; clamping is enough.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a-team:devClaimed by the a-team DevClaimed by the a-team Dev
Activity
a-team-app commentedon Oct 10, 2026
Blocked by #460: #460 reworks how files open into editor groups in Workbench, the same open paths this task hooks into; building on it avoids a clashing rewrite.
a-team-app commentedon Oct 11, 2026
Draft PR #514 is up.