mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 04:22:40 +08: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:
parent
8cc0bdeed8
commit
3ce67ecbd2
@ -698,7 +698,7 @@ impl<'a> builtin_printf_state_t<'a> {
|
||||
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/
|
||||
|
Loading…
x
Reference in New Issue
Block a user