Skip to content

Copy-pasting ASCII Tab character inside a string in JS destroys that character #6320

Closed as not planned
@juj

Description

@juj

Description of the bug

Copy-pasting ASCII Tab character inside a string in JS destroys that character, but it is expected that pasting a JS string should preserve the character contents of that string, and not alter it.

Steps to reproduce

0x09.zip

  1. Uncompress and open the file 0x09.js from the zip file.
  2. The first line contains a JS string with ASCII characters 0x01 through 0x0F in it. Of particular interest is the character 0x09, Horizontal Tab.
  3. Select the first line, and Copy it with Ctrl-C.
  4. Paste the first line into the document with Ctrl-V.

Expected behavior

The same string should be pasted a second time.

strings

Actual behavior

The character 0x09 (Horizontal Tab) is replaced with two spaces. This follows my IDE's Tab settings (Tab=2 spaces)

I understand such replacement in general, however, it would be expected that such replacement should not take place inside strings?

In our use case we are embedding binary data as UTF-8 code points in emscripten-core/emscripten#21426, with the intent of generating a more optimal compression than Base64. Such scheme works well, although it was observed that editing such files in Sublime Text becomes more difficult due to Sublime disturbing the contents inside strings.

Sublime Text build number

4126

Operating system & version

Windows 10

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions