Skip to content

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

Closed

Description

@a-team-app

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 run tuicode on 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 that Ln, 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), Enter in 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 WorkspaceStateStore does, paths inside .git never 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.md note on workspace state that says cursor positions aren't persisted yet.

Out of scope

Activity

  1. a-team-app commented on Oct 10, 2026

    @a-team-app
    ContributorAuthor

    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.

  2. a-team-app commented on Oct 11, 2026

    @a-team-app
    ContributorAuthor

    Draft PR #514 is up.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-team:devClaimed by the a-team Dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions