Repository navigation
MarkdownAura v1.6.1
MarkdownAura 1.6.1
修复:编辑过一次之后,分屏的滚动同步在"外界驱动"方向上死掉。 报告的症状:在分屏里进入编辑模式、
再退出,此后滚动右侧(渲染)窗格时左侧源窗格不动——直到用户先手动滚动一次左侧,两个方向才都活过来,
而再一次进出编辑又会把它带回去。实测(built app + CDP 时序追踪 scrollTop 写入)拆出三个级联缺陷,
只少一个都复现不出完整症状:
- 隐藏的编辑器把可见窗格的滚动偷走了(
src/ui/document.tsscrollerOf)。两个编辑器视图在模式结束
后仍驻留——它们的 state 里存着撤销历史,这是设计——但scrollerOf此前只问"这个窗格有没有编辑器",
于是把外界的滚动目标解析到display: none的宿主 里:零几何、读者永远看不见,syncSplit量到的
viewOf全是 0,写入的目标也落在那里。修复:只在窗格带着自己的editing类时才交出编辑器 scroller——
那个类正是syncEditor切换状态的同一处,谁也不能跟谁撒谎。 - 进/出模式没有交接阅读位置(
src/main.tsenterEdit/leaveEdit)。模式切换会触发paintActive
→renderDocument,后者用tab.scroll恢复滚动——而那个像素是 500ms 防抖的会话保存在另一种状态下
捕获的,恢复进来就是错的位置(编辑循环后落到页顶)。修复:两个方向都在状态翻转前走
capturePosition()(锚点+比例的描述,三个视图都认),重绘完再applyPosition(from)——与视图切换
(setView)已有的交接完全同构,SPEC §5 那句话现在覆盖两种切换。 applyPosition只写一个窗格(src/ui/document.ts)。另一半的跟进靠 scroll 事件,程序化赋值不
产生事件;写到一半、另一半留在原地(正是"退出后源窗格停在页顶"的最后一块)。修复:split 视图双写,
并把跟随方的目标写进expectedScroll回声表——与用户驱动同步的记账方式一致,两个半片不会互相推。
设计文件同步:design/IMPL.md §9"分屏同步的 bug 面"从两条细节改写为三条(隐藏宿主的裁决规则是新增
一条,附实测证据),§9 的视图切换条目扩写为"视图切换与进出编辑模式都走锚点交接、split 双写 + echo"。
验证(实测,不是读代码):Release 式时钟序 —— 只读态 out→pane 跟随;进出模式后编辑器落在阅读处
而非页顶;编辑器滚动驱动 out(比例 ~1.55);退出后窗格保留位置(此前是 0);out→pane 双向驱动在循环后
仍存活。npx tsc --noEmit、npm run build、design/check-prose-css.mjs 全部通过。
MarkdownAura 1.6.1
Fixed: after one edit cycle, split-view scroll sync goes dead in the externally-driven direction.
The reported symptom: enter the edit mode in a split, leave it again, and from then on scrolling the right
(render) half left the left source pane behind — until the reader scrolled the left half by hand once, which
brought both directions back, and another enter/leave undid it again. Driving the built app with CDP
scrollTop write traces split it into three cascading defects, and missing any one of them fails to
reproduce the whole thing:
- A hidden editor stole the visible pane's scroll (
src/ui/document.tsscrollerOf). Both editor views
stay mounted after the mode ends — their states carry the undo history, by design — butscrollerOfasked
only "does this pane have an editor", resolved scroll targets into thedisplay: nonehost: zero
geometry, invisible to the reader, and both theviewOfthe sync measured and the targets it wrote landed
there. The fix hands the editor scroller over only while the pane carries its owneditingclass — the
same flagsyncEditortoggles, so the two cannot disagree. - Neither entering nor leaving the mode handed the reading position over (
src/main.tsenterEdit/
leaveEdit). Mode changes repaint throughpaintActive→renderDocument, which restores from
tab.scroll— a pixel captured by the debounced session save in a different state, so restoring it lands
the reader wherever that save happened (the top of the document, after an edit cycle). Both directions now
capturePosition()before the flag flips andapplyPosition(from)after the repaint — the same handoff a
view switch (setView) already got; SPEC §5's sentence now covers both kinds of switch. applyPositionwrote one pane (src/ui/document.ts). The twin follows on scroll events, which a
programmatic assignment does not dispatch; one half moves, the other stays where it was — the last piece of
the "source pane stuck at the top after leaving" report. In split view both halves are written, and the
follower's target goes into theexpectedScrollecho the same way a user-driven sync records it.
The design file follows: design/IMPL.md §9's split-sync bug surface grew from two details to three (the
hidden-host adjudication rule is the new one, with the measured evidence), and the view-switch entry now
covers "a view switch and entering or leaving the edit mode anchor-carry the position, split writes both
halves + echo".
Verification (measured, not read): release-style clockwork — read-only out→pane follows; on entering, the
editor mounts at the reading place rather than the top; editor scrolling drives out (ratio ≈ 1.55); on
leaving, the source pane keeps its place (it landed at 0 before); both directions of the drive survive the
cycle. npx tsc --noEmit, npm run build, and design/check-prose-css.mjs all pass.