docs: allow modular code and refresh the handoff state

- AGENTS.md: new files and module splits need no approval; bug fixes,
  refactors, tests and docs can be done directly with one commit each.
  Only out-of-repo changes, releases, new third-party code and invariant
  changes still stop for a decision. Adds the exe-size and readability
  invariants.
- HANDOFF/STATUS/roadmap/README: correct the stale test count, file
  sizes, session-restore claims and session.json entry; record per-tab
  edit mode/scroll, the .txt removal, and the open editor-styling design
  question.
This commit is contained in:
2026-11-03 22:11:52 +08:00
parent 8221eb5908
commit 44fe93ec20
5 changed files with 45 additions and 17 deletions

View File

@@ -14,11 +14,11 @@
- 上游版本:`md-preview 1.4.2`(源码来自 `backup/md-preview-master.zip`)
- 改造目标:**本地预览器,不联网、不自动更新**;预览/编辑/标签/会话等功能与上游一致
- 源码规模:`src/main.rs` 4354 行、`src/session.rs` 281 行、`src/instance.rs` 207 行
- 源码规模:`src/main.rs` 5535 行、`src/session.rs` 488 行、`src/instance.rs` 207 行
- 当前产物(2026-11-02 起):`C:\Users\wucl1\Nutstore\1\Scripts\MD-Preview-windows-x64.exe`
- 当前发布版见 `STATUS.md` 第 2 节(v1.4.2-local.5,5,505,024 字节)
- 仓库内不再放成品 exe;旧 `D:\Scripts\md-preview\MD-Preview-windows-x64.exe` 由 `publish.ps1` 删除
- 测试:`cargo test` → 43 passed, 0 failed
- 测试:`cargo test` → 62 passed, 0 failed(2026-11-03)
- 编译警告:1 个 `dead_code`(macOS 专用事件枚举,Windows 下未构造),可忽略
- 2026-10-21 的全部功能需求已完成并部署,细节与实现要点见第 14 节。
@@ -88,8 +88,10 @@ python -c "d=open(r'MD-Preview-windows-x64.exe','rb').read(); print(d.count(b'ap
## 6. 保留的功能(回归时必须覆盖)
- 多标签、会话恢复、最近文件、缺失文件标签与重新定位
- 多标签、最近文件、缺失文件标签与重新定位
- 编辑模式与滚动位置按标签记忆:切回标签恢复离开时的模式与位置(2026-11-03)
- Markdown 预览(GFM、表格、任务列表、front matter、GitHub Alerts、高亮)
- 文档类型只认 `.md/.markdown/.mdown/.mkd`(2026-11-03 起不再打开 `.txt`)
- 源码编辑 + 700ms 防抖自动保存,关闭前 flush
- 查找(`Ctrl+F`;工具栏的 Find 按钮已移除)、打印、正文缩放 50%–300%(Ctrl+滚轮 / Ctrl± / Ctrl+0)、滚动进度保持
- 标题 hover 折叠(H1–H6;点 H2 折到下一个 H2、点 H3 折到下一个 H3;查找自动展开;打印全展开;不持久化)
@@ -127,7 +129,7 @@ Git 由用户自行初始化(私有仓库;`backup/` 与成品 exe 不入 git
`%LOCALAPPDATA%\md-preview\`:
- `session.json`:打开的标签与 active tab
- 旧 `session.json`:已停用,不读不写(可手动删除)
- `recent-files.txt`:最近文件(最多 8 个)
- `window.geom` / `theme.txt` / `zoom.txt`(正文缩放,50–300)
- `instance.lock` / `instance.json`:单实例
@@ -162,7 +164,7 @@ cargo test
- [ ] 窗口标题为 `文件名 — MD Preview`
- [ ] 工具栏只有 编辑 / 缩放(无 Update / Open / Print / Find)
- [ ] 多标签切换、关闭、会话恢复
- [ ] 多标签切换、关闭;切回标签仍保持编辑模式和滚动位置
- [ ] 编辑后 700ms 自动保存,关闭前落盘
- [ ] 第二个实例打开文件时,第一个实例新增标签、第二个退出
- [ ] `icacls "C:\Users\wucl1\Nutstore\1\Scripts\MD-Preview-windows-x64.exe"` 为 Medium
@@ -264,7 +266,7 @@ cargo test
### 14.3 验证配方
```powershell
cargo test # 43 passed
cargo test # 62 passed
.\agent\scripts\build.ps1 # 先关闭正在运行的实例;会打印 SHA256 并校验 Medium
```