mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-19 11:31:26 +01:00
23136: handle Bnulls now added in $'...'
This commit is contained in:
parent
040db61c32
commit
df54eeed2c
3 changed files with 29 additions and 9 deletions
|
@ -1,3 +1,8 @@
|
|||
2007-01-27 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 23136: Src/utils.c, Test/A03quoting.ztst: 23097 added Bnulls
|
||||
for backslashes in $'...' strings but then didn't handle them.
|
||||
|
||||
2007-01-26 Wayne Davison <wayned@users.sourceforge.net>
|
||||
|
||||
* unposted: Src/Zle/zle_tricky.c: fixed the error checking of
|
||||
|
|
29
Src/utils.c
29
Src/utils.c
|
@ -4914,23 +4914,34 @@ getkeystring(char *s, int *len, int how, int *misc)
|
|||
} else if (*s == Meta)
|
||||
*t++ = *++s ^ 32;
|
||||
else {
|
||||
*t++ = *s;
|
||||
if (itok(*s)) {
|
||||
if (meta || control) {
|
||||
/*
|
||||
* Presumably we should be using meta or control
|
||||
* on the character representing the token.
|
||||
*/
|
||||
*s = ztokens[*s - Pound];
|
||||
*t++ = ztokens[*s - Pound];
|
||||
} else if (how & GETKEY_DOLLAR_QUOTE) {
|
||||
/*
|
||||
* We don't want to metafy this, it's a real
|
||||
* token.
|
||||
*/
|
||||
*tdest++ = *s;
|
||||
if (*s == Bnull) {
|
||||
/*
|
||||
* Bnull is a backslash which quotes a couple
|
||||
* of special characters that always appear
|
||||
* literally next. See strquote handling
|
||||
* in gettokstr() in lex.c.
|
||||
*/
|
||||
*tdest++ = *++s;
|
||||
} else {
|
||||
/*
|
||||
* We don't want to metafy this, it's a real
|
||||
* token.
|
||||
*/
|
||||
*tdest++ = *s;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else
|
||||
*t++ = *s;
|
||||
} else
|
||||
*t++ = *s;
|
||||
}
|
||||
if (meta == 2) {
|
||||
t[-1] |= 0x80;
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
>'ut queant laxis'
|
||||
>"resonare fibris"
|
||||
|
||||
print -r $'\'a \\\' is \'a backslash\' is \'a \\\''
|
||||
0:$'-style quotes with backslashed backslashes
|
||||
>'a \' is 'a backslash' is 'a \'
|
||||
|
||||
print -r ''''
|
||||
setopt rcquotes
|
||||
# We need to set rcquotes here for the next example since it is
|
||||
|
|
Loading…
Reference in a new issue