Markdown editor: Undo groups typing one character at a time
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Description
In the experimental Markdown editor, naturally typed text is recorded as one undo step per character. This makes undo noisy and prevents users from reverting a contiguous typing action as one meaningful edit.
## Reproduction Steps
1. Open `http://localhost:5178/?theme=vscode-default`.
2. Focus a paragraph in the Markdown editor.
3. Type a multi-character phrase naturally using the keyboard (do not use `insertText` or paste).
4. Press Cmd+Z on macOS or Ctrl+Z on Windows/Linux.
5. Repeat the undo command.
## Expected Behavior
The contiguous typing action is undone as one meaningful batch. A single undo removes the phrase typed in step 3.
## Actual Behavior
Each undo removes only one character, so reverting the phrase requires one undo per character.
## Confirmed Root Cause
- Chrome EditContext emits one `textupdate` event per character in `packages/core/src/controller/editorController.ts` around lines 148-170.
- Each event becomes a separate model transaction in `packages/core/src/model/editorModel.ts` around lines 354-367 and a separate history entry in `packages/core/src/model/historyStrategy.ts` around lines 52-79.
- The VS Code bridge forwards every model change in `packages/explorer/src/editor.ts` around lines 280-287.
- `markdownEditorProvider.ts` applies each forwarded change with a separate `workspace.applyEdit` call around lines 130-149, creating separate host undo groups.
The per-character EditContext updates therefore remain separate through both model history and the VS Code host undo stack.
## Additional Context / Fix Direction
Introduce typing-group metadata/coalescing across the model-to-host bridge so contiguous typing shares an undo group. Explicitly flush the active typing group at semantic boundaries including navigation, Enter, paste, pointer interaction, blur, composition boundaries, external edits, and undo/redo.
Related but not a duplicate: #327535 covered undo/redo not applying edits at all; this report concerns grouping after undo/redo is functional.
Contributor guide
Assessment
This issue has not been assessed yet.