Touch pull survives CodeMirror redraws (#1134) #1185

Open
kayg wants to merge 1 commit from fix/flake-1134 into dev
Owner

Fixes #1134. The block pull is now a line decoration plus a CSS variable, so a CodeMirror redraw keeps it.

Root cause. follow.ts set style.transform on CodeMirror's own .cm-line elements. The picker's lazy install (transforms/picker.ts loadPicker, slot.reconfigure(install(m)) after the dynamic import) lands a few tens of ms after the swipe starts on a loaded machine. A compartment reconfigure redraws the lines, and CodeMirror's setAttrs removes the attributes it doesn't know, so the inline transform was wiped for a frame.

Fix. New blocks/pulled.ts:

  • a StateField that decorates the pulled block's lines with cm-pulled (a Decoration.line, CodeMirror's own state, kept across redraws and reconfigures);
  • .cm-pulled { transform: translateX(var(--pull-x)) };
  • the distance is one setProperty('--pull-x') on the editor root, which CodeMirror never touches.

A transaction is dispatched only when a pull starts or ends, so there is nothing to flicker and no listener re-applies anything. The feature is unchanged. The spec now reads the drawn transform (computed matrix), and the assertions are the same.

Perf. The new field's update is one null check per transaction when no pull is active, and the same early-return pattern as picked and swipe-hold. I did not take a ts1134 ticket: nothing per-keystroke does work, and the queue was long. Say so if you want the ABAB anyway.

Evidence is in the #1134 comment. Not merged.

🤖 Generated with Claude Code

Fixes #1134. The block pull is now a line decoration plus a CSS variable, so a CodeMirror redraw keeps it. **Root cause.** `follow.ts` set `style.transform` on CodeMirror's own `.cm-line` elements. The picker's lazy install (`transforms/picker.ts` `loadPicker`, `slot.reconfigure(install(m))` after the dynamic import) lands a few tens of ms after the swipe starts on a loaded machine. A compartment reconfigure redraws the lines, and CodeMirror's `setAttrs` removes the attributes it doesn't know, so the inline transform was wiped for a frame. **Fix.** New `blocks/pulled.ts`: - a StateField that decorates the pulled block's lines with `cm-pulled` (a `Decoration.line`, CodeMirror's own state, kept across redraws and reconfigures); - `.cm-pulled { transform: translateX(var(--pull-x)) }`; - the distance is one `setProperty('--pull-x')` on the editor root, which CodeMirror never touches. A transaction is dispatched only when a pull starts or ends, so there is nothing to flicker and no listener re-applies anything. The feature is unchanged. The spec now reads the drawn transform (computed matrix), and the assertions are the same. **Perf.** The new field's update is one `null` check per transaction when no pull is active, and the same early-return pattern as `picked` and `swipe-hold`. I did not take a `ts1134` ticket: nothing per-keystroke does work, and the queue was long. Say so if you want the ABAB anyway. Evidence is in the #1134 comment. Not merged. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Keep the block pull when CodeMirror redraws the lines (#1134)
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled
d2e4f08d5d
follow.ts set style.transform on CodeMirror's own .cm-line elements. Any update that
redraws the line (found: the picker's lazy install, a compartment reconfigure that
lands a few tens of ms after the swipe starts on a loaded machine) rewrites the
line's attributes and drops the style, so the pull vanished for a frame.

The pulled lines now carry a class from a line decoration (CodeMirror's own state, kept
across redraws and reconfigures) and the distance lives in --pull-x on the editor's
root. Moving the block each frame is one setProperty; a transaction happens only
when a pull starts or ends. The spec reads the drawn transform.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'fix/flake-1134:fix/flake-1134'
git switch 'fix/flake-1134'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'dev'
git merge --no-ff 'fix/flake-1134'
git switch 'fix/flake-1134'
git rebase 'dev'
git switch 'dev'
git merge --ff-only 'fix/flake-1134'
git switch 'fix/flake-1134'
git rebase 'dev'
git switch 'dev'
git merge --no-ff 'fix/flake-1134'
git switch 'dev'
git merge --squash 'fix/flake-1134'
git switch 'dev'
git merge --ff-only 'fix/flake-1134'
git switch 'dev'
git merge 'fix/flake-1134'
git push origin 'dev'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!1185
No description provided.