microsoft / microsoft/pxt-microbit

Bugs in using escape characters

Open
#1,940 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

from micro:bit support P2 serial typescript
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

micro:bit-support: 21346
Describe the bug
In blocks entering within Serial Write Line, Serial Write String on in a general string assignment, entering a character escape sequence such as “\r” adds extra “\”
If the character required is \”, then two extra \ are added.
ecape

Entering a character escape sequence in Javascript gives an unrendered block sometimes.
A round trip from JS to blocks back to JS results in a null being added at the front i.e if the string is “\r” then the round trip results in “” + “\r”
escape2

Entering hex number as a character escape crashes program and all work is lost e.g. for control-Z “\0x1a”
escape3

There is a documented block https://makecode.microbit.org/reference/math/from-char-code to enter a character code that renders if you use eg let ctrlZ = String.fromCharCode(26) and switched to bklocks, but this doesn't appear in the Text Block menu. Can this be added?
escape4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported cases in Serial Write Line, Serial Write String, general string assignments, and the JavaScript-to-blocks round trip. Check the existing math/from-char-code entry point and the Text Block menu. Done means escape sequences round-trip correctly, hexadecimal input does not crash or lose work, and the documented character-code block is available in the Text Block menu.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.