Skip to content

Commit

Permalink
Skip variant selectors in deleteCharBackward
Browse files Browse the repository at this point in the history
FIX: `deleteCharBackward` will no longer delete variant selector characters
as separate characters.

See https://discuss.codemirror.net/t/backspace-on-some-multi-codepoint-glyphs-deletes-characters-separately/7403
  • Loading branch information
marijnh committed Nov 11, 2023
1 parent e27916c commit fd8055b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ const deleteByChar = (target: CommandTarget, forward: boolean) => deleteBy(targe
targetPos = findClusterBreak(line.text, pos - line.from, forward, forward) + line.from
if (targetPos == pos && line.number != (forward ? state.doc.lines : 1))
targetPos += forward ? 1 : -1
else if (!forward && /[\ufe00-\ufe0f]/.test(line.text.slice(targetPos - line.from, pos - line.from)))
targetPos = findClusterBreak(line.text, targetPos - line.from, false, false)
}
return targetPos
})
Expand Down

0 comments on commit fd8055b

Please sign in to comment.