Commit Graph

90 Commits

Author SHA1 Message Date
56a167d98c docs: prepare v1.4.2-local.7 release v1.4.2-local.7 2026-11-11 14:37:49 +08:00
6565352ab5 fix(editor): track dirty changes after the first autosave
CodeMirror 5 change handlers receive (instance, changeObj). The handler named the first argument change, so once the fold gutter populated __mdpFenceCache it threw on change.from.line before setDirty(true). Edits after the first autosave stayed clean: Ctrl+S and Ctrl+E skipped saving and the preview stayed stale. Use the correct signature, return early for remote setValue, and guard the cache update. Add a page regression test.
2026-11-11 14:19:16 +08:00
f1bda62d84 docs: prepare v1.4.2-local.6 release v1.4.2-local.6 2026-11-06 11:29:38 +08:00
0bbb840778 docs: record the CodeMirror 5 editor work 2026-11-06 11:23:31 +08:00
e911876bbb fix(editor): preserve BOM, load tabs reliably and cache fence state 2026-11-06 11:18:26 +08:00
f300abf359 fix(editor): keep the edit find bar out of preview find mode 2026-11-06 11:12:42 +08:00
10f1d4fca2 style(editor): match replace-button hover with find controls 2026-11-06 11:10:16 +08:00
0544c78633 style(editor): make replace buttons text-only and bold 2026-11-06 11:06:07 +08:00
171fbaf59d fix(editor): hide UTF-8 BOM and lighten replace buttons 2026-11-06 10:58:23 +08:00
a206ce8450 fix(editor): stable per-tab line restore and fold closing fences 2026-11-06 10:12:18 +08:00
9f12b91a14 fix(editor): fold fence parity, search bar layout and per-tab scroll memory 2026-11-06 10:03:23 +08:00
2117551af7 fix(editor): fold ranges, stacked replace bar and container scrolling 2026-11-06 09:14:20 +08:00
a58a94b05f fix(editor): add find/replace bar and tidy CodeMirror scrolling 2026-11-06 09:00:35 +08:00
715c8068f8 feat(editor): run markdown source editing on CodeMirror 5 2026-11-06 08:23:13 +08:00
8b4d1fa03e build: vendor CodeMirror 5.65.16 for the source editor 2026-11-06 08:23:13 +08:00
b2a4fd41ca refactor(page): route editor access through an adapter 2026-11-06 08:17:59 +08:00
0bb804e4df docs: decide on CodeMirror 5 for the editor 2026-11-06 08:12:50 +08:00
6c0bb8253b docs: record the test relocation and slim main entry 2026-11-06 07:36:09 +08:00
a5c0b0801d refactor: move module tests into their files and startup into app::run 2026-11-06 07:35:49 +08:00
3ecf96fb04 docs: record the files.rs and app.rs refactor stages 2026-11-06 07:27:25 +08:00
fb10fc5de0 refactor(app): move app state, rendering and event loop into app.rs 2026-11-06 07:27:10 +08:00
1208386452 refactor(files): move file IO, watcher and link helpers into files.rs 2026-11-06 07:23:51 +08:00
d78d1aa722 docs: record the UI verification workflow and its limits
- AGENTS §3: UI/GUI verification must be run by the user via
  ui-smoke.cmd; the DSH sandbox blocks named pipes so WebView2 cannot
  start, and Rust->JS calls have no compiler check.
- HANDOFF §4.1: canonical description (why the sandbox fails, the script
  flow, the report/screenshot outputs, when to run it, maintenance notes).
- STATUS §12: current verification matrix; README: command.
2026-11-04 17:33:34 +08:00
1ad4a265c3 docs: record the passing UI smoke and add it to the checklists
ui-smoke.cmd ran on the user's desktop: 8/8 checks, screenshot shows the
page restored (tab bar, headings, VS Dark code block). Add it to the README
build steps and the HANDOFF acceptance checklist, and note the verified run
in STATUS.
2026-11-04 17:30:19 +08:00
a4616d0228 fix: resolve node correctly and wait for a real CDP endpoint
The smoke script passed a CommandInfo from Get-Command straight to
Test-Path, so Node was reported missing even when installed. Resolve the
executable path (Get-Command .Path, then the usual install directories) and
add a -Node override.

Wait for /json/list to answer instead of a TCP connect: WebView2 opens the
port briefly and dies under the sandbox, which made the script run the
driver against a dead endpoint. The summary now reports report.errors
instead of printing "OK: 0 checks".
2026-11-04 17:28:37 +08:00
9a568774d8 chore: keep .cmd wrappers CRLF in the working tree 2026-11-04 17:12:43 +08:00
2fc3f740ca test: add a bypass wrapper for the UI smoke script
Windows PowerShell with an AllSigned policy refuses unsigned .ps1 files.
ui-smoke.cmd runs ui-smoke.ps1 with a process-scoped -ExecutionPolicy Bypass
(no system policy change) and keeps the window open when double-clicked.
2026-11-04 17:12:32 +08:00
590a9a016c fix: restore the page content call and stop writing the registry
- render_active_document passed the tab id as the first __setContent argument,
  but the page signature starts with previewHtml, so #preview rendered the tab
  id ("1", "2", "3" as tabs were opened) and the window looked blank. The call
  now goes through set_content_script(), and a test pins the exact script plus
  the page signature so the two cannot drift silently.
- remove register_as_default() and the winreg dependency: the app no longer
  writes HKCU on launch. publish.ps1 still refreshes the .md association.
2026-11-04 15:25:13 +08:00
0b97bcb6dc test: add a CDP-based pre-release UI smoke harness
The DSH sandbox blocks named pipes, so Chromium/WebView2 cannot start inside
it (window renders white, msedgewebview2 exits immediately; Edge headless
fails with a Mojo platform-channel access-denied fatal). UI verification
therefore moves to a script the user runs from a normal desktop shell.

- agent/tests/ui-smoke.ps1: launches the built exe with an isolated config
  and --remote-debugging-port, waits for the port, runs the driver, closes.
- agent/tests/ui-smoke.mjs: connects over CDP, snapshots the page (preview
  content, headings, fold toggles, highlighted code, window.ipc bridge),
  saves a screenshot and a JSON report for the agent to read.
- The driver was validated against a mock CDP server; the real end-to-end run
  needs a desktop shell (sandbox cannot host WebView2).
2026-11-04 15:15:24 +08:00
fadba614a8 docs: record the Windows-only split and the next steps
Adds agent/docs/next-2026-11-03.md: the remaining refactor, the decided but
unimplemented HKCU removal (publish.ps1 stays as is) and the editor-styling
design (no implementation chosen yet).
2026-11-03 23:22:33 +08:00
d0e374a02c refactor: make the crate Windows-only and extract config
- delete the macOS/Linux/Finder-extension code, the non-Windows branches and
  the objc2 dependencies; three platform-only tests went with them (62 -> 59).
- src/config.rs: config dir, zoom, window geometry and the blocking dialogs.
- move the test module to the end of main.rs (clippy items_after_test_module).
- main.rs 3709 -> 2822 lines. No behavior change on Windows.
2026-11-03 23:22:33 +08:00
d5ba2495ba docs: record the page/markdown module split 2026-11-03 23:03:44 +08:00
1115052762 refactor: split the page, markdown pipeline and escaping out of main.rs
- assets/page/{page.html,page.css,page.js} now hold the UI. build_page only
  fills __MDP_*__ placeholders, so editing the page no longer means escaping
  braces inside a format! string. Output was verified byte-identical for the
  home page, a math/mermaid document and the startup page.
- src/markdown.rs: md -> html pipeline (GFM, AI-output dialect, front matter,
  embedded images, ==highlight==, heading ids).
- src/page.rs: page assembly.
- src/escape.rs: shared JS/HTML escaping.
- src/main.rs drops from 5535 to 3709 lines. No behavior change; 62 tests.
2026-11-03 23:02:58 +08:00
44fe93ec20 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.
2026-11-03 22:11:52 +08:00
8221eb5908 chore: clear clippy warnings and tighten the build guard
- base64_encode uses div_ceil plus a slice loop (clippy: manual_div_ceil,
  chunks_exact_to_as_chunks); add known-vector tests.
- macOS-only UserEvent variants no longer warn on Windows.
- needless borrow, needless bool, and a collapsible match arm in the
  Destroyed handler.
- build.ps1 no longer treats the word "powershell" as an updater marker;
  it now checks Start-Process / Invoke-WebRequest instead.
2026-11-03 22:11:03 +08:00
c783a6dc56 fix: stop treating .txt as a supported document
Plain text was listed in the open, locate and link handlers but the file
dialog never offered it for new files, and a .txt opened through the app
behaved like Markdown without being one. Drop the extension everywhere so
the supported set is one list: md, markdown, mdown, mkd.
2026-11-03 22:10:01 +08:00
dfe38890e0 fix: remember edit mode and scroll position per tab
Edit mode used to live on the window, so switching tabs carried the mode
across documents, and the viewport stayed at whatever pixel the previous
document had scrolled to.

- DocumentTab now owns editing and scroll_ratio.
- The page reports edit-mode and scroll changes by tab id; Rust restores
  them when the tab is activated. Reports carry the id so a late report
  cannot land on the tab that just became active.
- Detaching a tab keeps its edit mode instead of forcing preview.
2026-11-03 22:09:34 +08:00
8d98b5e7a9 fix: add UTF-8 BOM to PowerShell scripts for Windows PowerShell 5.1 2026-11-02 01:31:51 +08:00
d2b1630a35 chore: switch to Low workspace and Nutstore-only publish
- build.ps1: dev build only; no copy to a fixed exe
- publish.ps1: user-run Medium publish to Nutstore
- docs: workspace stays D:\Scripts\md-preview, repo under AgentLowWorking
- .gitignore: local test/ scratch directory
2026-11-02 01:26:49 +08:00
301e042bec docs: record v1.4.2-local.5 release 2026-10-30 18:50:21 +08:00
d54b953094 docs: prepare v1.4.2-local.5 release v1.4.2-local.5 2026-10-30 18:49:12 +08:00
618ac47b83 feat: find from the selected preview text without scrolling
Ctrl+F fills the find box from the current preview selection, anchors the first hit to that selection, and suppresses scroll when the find box opens. Typed queries still start from the current viewport and next/previous still reveal their target.
2026-10-30 18:48:48 +08:00
8644966b10 feat: add tab and auto-indent to the editor
Tab inserts two spaces, Shift+Tab outdents selected lines, and Enter carries the current line's leading whitespace. Native textarea undo is preserved and IME composition is left alone.
2026-10-30 18:48:45 +08:00
dd4083fe80 docs: prepare v1.4.2-local.4 release
- Record the New Tab model and English-only UI
- Document the release build hash and deployment
- Add v1.4.2-local.4 release notes
v1.4.2-local.4
2026-10-28 19:39:23 +08:00
d90e47e606 feat: make the UI English-only
- Remove locale detection and the Chinese Strings set
- Label the new-tab page New Tab instead of Home
- Use Untitled defaults for Finder-created files
- Drop the sys-locale dependency
2026-10-28 19:37:50 +08:00
809b7b0299 feat: add Home as the default tab
- Model Home as a tab without a file path (Option<PathBuf>)
- + creates a Home tab; opening a file from Home reuses that tab
- Add a New File button to the Home page (replaces + for file creation)
- Closing the last file tab falls back to a Home tab
- Hide the tab strip while the only tab is Home
- Keep Home tabs out of detach, reveal, watcher, and duplicate checks
2026-10-28 18:21:53 +08:00
abeb426a43 docs: authorize Nutstore mirror after release 2026-10-28 17:41:57 +08:00
47e71cf692 docs: record v1.4.2-local.3 release 2026-10-28 17:38:06 +08:00
52de3f9a0f docs: prepare v1.4.2-local.3 release v1.4.2-local.3 2026-10-28 17:36:51 +08:00
9ae2c134ad fix: keep detached windows on source monitor and refine tab actions 2026-10-28 17:02:46 +08:00