Restore the browser page on relaunch, not the last edited file

A relaunch session always re-opened the last edited file, even when the
app was closed sitting on the browser page. The snapshot now records
which page the app was on (SessionState.InBrowser/BrowserPath); the cmd
layer lands back in the browser at the saved directory on relaunch
(falling back to the startup directory if it has vanished) instead of
calling BeginRestore. Browser-page snapshots clear File, which also
makes the editor->browser transition an urgent save, so the
back-in-browser state hits disk immediately. Legacy session files (no
InBrowser key) unmarshal to false and restore the editor exactly as
before.

Verified on emulator and phone: editor sessions still restore the file
(cursor/scroll/font), browser sessions land in the browser at the saved
dir; legacy files keep the old behavior. New e2e regression test
TestRestore_BrowserPageSession.
This commit is contained in:
gmp
2026-09-03 12:11:44 -04:00
parent 4a3ba37075
commit e96464ec79
4 changed files with 119 additions and 17 deletions
+7 -4
View File
@@ -141,10 +141,13 @@ elsewhere.
### 2.4 State restoration on relaunch
- On launch, Pad re-opens the file from the last session and lands straight
on the editor page, restoring the cursor, scroll position, live selection,
and the find bar (query, open/closed, current match). A relaunch therefore
never requires re-browsing to the last file.
- On launch, Pad lands exactly where the last session ended. If the app was
in the editor, it re-opens the last file straight on the editor page,
restoring the cursor, scroll position, live selection, and the find bar
(query, open/closed, current match) — a relaunch therefore never requires
re-browsing to the last file. If the app was on the browser page, it lands
back in the browser at the saved directory (`InBrowser`/`BrowserPath` in
the snapshot; a deleted directory falls back to the startup directory).
- The scroll position is persisted as the LOGICAL line at the viewport top
plus the sub-line remainder (the raw pixel offset is kept too, for
pre-line-coordinate session files). The pixel offset alone is not