Skip to content

Backspace doesn't handle zero width joiners (and combining marks) correctly.Β #22486

@brandf

Description

@brandf
  • VSCode Version: Code 1.10.2 (8076a19, 2017-03-08T14:02:52.799Z)
  • OS Version: Windows_NT ia32 10.0.14393
  • Extensions:
Extension Author Version
cpptools ms-vscode 0.9.2

Steps to Reproduce:

  1. paste this emoji: πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘§
  2. hit backspace

Expected: deletes entire emoji (like it does in this html form).
Result: deletes the right kid, leaving you with πŸ‘©β€πŸ‘©β€πŸ‘§β€.

I've had this same bug in my own code once. It's because javascript has derpy non-utf-8 strings. Single utf-8 characters will be multiple javascript string characters. I don't know the correct terminology, but just play with it and see what I mean. I found the correct way to delete character off javascript strings to be:

                    var chars = Array.from(text);
                    chars.pop();
                    text = chars.join('');

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions