diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-03-03 02:57:00 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-03 11:57:00 +0100 |
commit | e417bd62f7937c09a1508db25b7cdb3a7f153632 (patch) | |
tree | 14d8fba7ef7cbdd8f6da98d7633ce2210ce993fd | |
parent | 507873be25baa06d7da3c44b0c36d253c850625d (diff) | |
download | Nim-e417bd62f7937c09a1508db25b7cdb3a7f153632.tar.gz |
\r now renders as \r, not \c which was not standard (#17244)
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | lib/system.nim | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/changelog.md b/changelog.md index 771a08ba6..4685e296e 100644 --- a/changelog.md +++ b/changelog.md @@ -189,6 +189,8 @@ provided by the operating system. - `std/options` changed `$some(3)` to `"some(3)"` instead of `"Some(3)"` and `$none(int)` to `"none(int)"` instead of `"None[int]"`. +- `system.addEscapedChar` now renders `\r` as `\r` instead of `\c`, to be compatible + with most other languages. ## Language changes diff --git a/lib/system.nim b/lib/system.nim index 559c71f01..dff095f5d 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2838,7 +2838,7 @@ proc addEscapedChar*(s: var string, c: char) {.noSideEffect, inline.} = ## * replaces any `\n` by `\\n` ## * replaces any `\v` by `\\v` ## * replaces any `\f` by `\\f` - ## * replaces any `\c` by `\\c` + ## * replaces any `\r` by `\\r` ## * replaces any `\e` by `\\e` ## * replaces any other character not in the set `{'\21..'\126'} ## by `\xHH` where `HH` is its hexadecimal value. @@ -2851,10 +2851,10 @@ proc addEscapedChar*(s: var string, c: char) {.noSideEffect, inline.} = of '\a': s.add "\\a" # \x07 of '\b': s.add "\\b" # \x08 of '\t': s.add "\\t" # \x09 - of '\L': s.add "\\n" # \x0A + of '\n': s.add "\\n" # \x0A of '\v': s.add "\\v" # \x0B of '\f': s.add "\\f" # \x0C - of '\c': s.add "\\c" # \x0D + of '\r': (when defined(nimLegacyAddEscapedCharx0D): s.add "\\c" else: s.add "\\r") # \x0D of '\e': s.add "\\e" # \x1B of '\\': s.add("\\\\") of '\'': s.add("\\'") |