mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 03:51:14 -03:00
printf: Fix octal escapes with leading zeroes
Octal escapes can be written as `\057` or as `\0057`. Simply ported wrong initially.
This commit is contained in:
@@ -698,7 +698,7 @@ fn print_esc_string(&mut self, mut str: &wstr) {
|
||||
while !str.is_empty() {
|
||||
let c = str.char_at(0);
|
||||
if c == '\\' {
|
||||
let consumed_minus_1 = self.print_esc(str, false);
|
||||
let consumed_minus_1 = self.print_esc(str, true);
|
||||
str = &str[consumed_minus_1..];
|
||||
} else {
|
||||
self.append_output(c);
|
||||
|
||||
@@ -147,3 +147,7 @@ echo
|
||||
printf --help
|
||||
echo
|
||||
# CHECK: --help
|
||||
|
||||
# This is how mc likes to encode the directory we should cd to.
|
||||
printf '%b\n' '\0057foo\0057bar\0057'
|
||||
# CHECK: /foo/bar/
|
||||
|
||||
Reference in New Issue
Block a user