You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Cutting from a nested code block's language box replaces the whole list or quote #5368
When a code block sits inside a list item or a block quote, replacing a selection that starts in its language box (typing, pasting or pressing Backspace over it) replaces the whole list or quote with a single paragraph. Every other list item or quote paragraph is deleted, including content outside the selection.
Shift+↓ from the end of the language box selects exactly such a range (from the language into the first code line).
A code block at the top level of the document is handled correctly (#918): only the code block turns into a paragraph.
Steps to Reproduce
Open a document with:
- item one
```jsconsta=1```- item two
Click in the code line so the language box js shows, then click right after js.
Press Shift+↓ and type q.
Also with a quote:
> quote>> ```js> code>```>> tail
(select from the start of js into code, press Backspace).
Expected Behavior
Only the code block that holds the language box collapses into a paragraph, as it does at the top level; the list or quote around it and all its other content stay:
- item one
jsqnst a = 1
- item two
Actual Behavior
Measured with real mouse and keyboard input in MarkText 0.20.0-rc.2 on macOS, and on develop @ 8bcb1e0 (muya e2e host):
Document
Action
Saved markdown
list above
end of js, Shift+↓, type q
jsqnst a = 1 — item one and item two are gone
quote above
select js → co, Backspace
de — quote and tail are gone
list above plus a paragraph after
select from `j
stoaf
No error is shown.
Screenshots / Logs
Analysis:collapseLanguageInputCut() (packages/muya/src/clipboard/cut.ts, added for #918) replaces startBlock.outMostBlock with the merged paragraph. For a code block nested in a list or quote the outermost block is the list or quote itself, not the code block.
Activity
fix(muya): collapse only the nested code block when a cut starts in i…
fix: keep code blocks and tables intact when a cut crosses into or ou…
fix: keep code blocks and tables intact when a cut crosses into or ou…
fix: keep code blocks and tables intact when a cut crosses into or ou…