Skip to content

fix: ten pre-release review findings for 0.10.0 - #27

Merged
borghei merged 11 commits into
mainfrom
fix/review-0-10-0
Oct 1, 2026
Merged

borghei merged 11 commits into
mainfrom
fix/review-0-10-0

Conversation

@borghei

@borghei borghei commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the ten findings from the high-effort code review of v0.9.0..main, one commit and regression test each.

  1. Math nesting is capped on every recursive entry; 200,000 nested \sqrt[ no longer overflows the stack.
  2. ^superscript^ and ||spoiler|| syntax is turned off: both rewrote ordinary prose (2^10 and 3^5, (a||b) or (c||d)). <sup>/<sub> remain.
  3. <sub>/<sup> keep links and styling; only short plain text with script forms becomes Unicode sub/superscript.
  4. A leading JSON object is never hidden. With --frontmatter it gets the metadata box only when markdown follows.
  5. Table of contents focus is dropped when the sidebar is not drawn.
  6. --line-range repairs fences inside blockquotes and list items.
  7. Bracketed frontmatter values are shown verbatim unless they are a real list.
  8. State-diagram fallback notes skip unnamed pseudo-states.
  9. On Windows, the editor launcher resolves .cmd/.bat shims through PATH and PATHEXT.
  10. The three tab-reload paths share one helper with an explicit anchor policy.

Testing

fmt, clippy and the full suite pass locally, including the pty suite. No snapshots changed. The Windows call site is compiled by this PR's CI only.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UVcvmQrSXd2eyt32g4ko19

borghei added 11 commits October 1, 2026 18:38
…es in one pass

$\sqrt[\sqrt[...x$ recursed once per index with no depth check and
re-scanned the remainder at each level, aborting the process on a deep
enough formula. A linear pre-scan now shows any formula nested deeper than
32 levels as its source, every recursive entry (seq, command, environment)
checks the cap itself, and the \sqrt index is rendered in place.
Both comrak extensions paired carets and double bars in ordinary prose:
'Compute 2^10 and 3^5' rendered as 2^(10 and 3)5, and '(a||b) or (c||d)'
hid 'b) or (c'. Neither is GitHub markdown, so both are off and such text
renders verbatim as in v0.9.0. <sup>/<sub> HTML still gives scripts.
Any document whose first line was { and that had a "key": line was
stripped as JSON frontmatter, so a file that is a JSON object printed
nothing. JSON is now recognised only with --frontmatter and only when
markdown follows the object; then it gets the metadata box. Without the
flag a leading JSON object is document text, as in v0.9.0. YAML/TOML are
unchanged.
close_script collapsed everything between the tags into one span with
the first span's style and wrapped it in _(...)/^(...), so a <sub> caption
lost its links. The Unicode script mapping now applies only to a single
plain-text run whose every character has a script form (^(x)/_(x) in
ASCII mode); anything else is left exactly as it was, with no wrapper.
Any value starting with [ and ending with ] was read as a flow list and
lost its outer brackets: 'link: [text](url) and [more]' showed as
'text](url) and [more'. A value is a list now only when its opening [ is
closed by the final ] (quotes respected); otherwise it is shown verbatim.
Fence detection only looked at indent 0-3 of the raw line, so a block in a
blockquote (> ```py) or an indented list item was neither reopened nor
had its orphan closer dropped: --line-range 7 printed the code as quote
prose, 7: opened an empty code box swallowing the rest. Blockquote markers
and list indentation are now stripped when detecting fences, the prefix is
remembered, and reopened/closing fences are emitted with it. A block
reopened inside a list item is drawn at the top level, well-formed.
Focusing the TOC and then shrinking the window to 40 columns or fewer hid
the sidebar but left it focused: keys moved an invisible cursor and the
status bar kept the TOC hints. One sidebar_shown() rule now decides the
draw, the layout width and the focus action, and every frame drops focus
(and any filter) when the sidebar is not shown.
When composite-state or subgraph frames could not be drawn, the fallback
note listed every member, including the unlabelled [*] start/end states:
"Running: , A, B, ". Members with an empty label are now skipped.
std's Command only appends .exe on Windows, so EDITOR="code --wait" (VS
Code, Cursor and VSCodium install code.cmd and the like) failed with
"program not found". A bare editor name is now resolved against PATH and
PATHEXT (default .COM;.EXE;.BAT;.CMD) by a pure, unit-tested function and
the full path is spawned; explicit paths and names with an extension are
left alone. std quotes .bat/.cmd arguments itself and refuses ones it
cannot escape; that error is shown in the status bar. The Windows
behaviour itself is not verified on Windows.
rebuild_tab, the --watch branch and reload_after_edit each rebuilt a tab
and each had to remember the sidebar's visibility, its interaction state
and the current-heading selection. They now share reload_tab with an
explicit Anchor (KeepOffset for re-layout and --watch, Heading after e).
The accidental differences are unified: rebuild_tab clamped the offset to
len - 1, now len - viewport like every scroll and the other two paths.
viewport_heading reuses TocState::current_heading, the rule
update_selection uses. Toggling or focusing the TOC re-lays out at a new
width and now refreshes search matches, as a resize already did.
500 ms was within noise of a busy CI runner (the frac case took 500.6 ms
on ubuntu-latest); the test guards against quadratic behaviour that took
minutes, so a 20 s bound still catches it.
@borghei
borghei merged commit 3b62ca0 into main Oct 1, 2026
8 checks passed
@borghei
borghei deleted the fix/review-0-10-0 branch October 1, 2026 17:12
@borghei borghei mentioned this pull request Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant