summaryrefslogtreecommitdiff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
committerAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
commitb09f4483416c54c1782824633dfabaf2ec0265b6 (patch)
tree304bc82642862525ae680c7fbaa249663b10ad57 /Src/lex.c
parent12eb3e5356f2fc3351eed58ef1cef1b8fb83b504 (diff)
parent6e55c920503071e917619b8cb1a188cd35d772db (diff)
downloadzsh-b09f4483416c54c1782824633dfabaf2ec0265b6.tar.gz
zsh-b09f4483416c54c1782824633dfabaf2ec0265b6.zip
New upstream version 5.8.1.2-test
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 1d86da94e..ece02659e 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -270,7 +270,7 @@ zshlex(void)
do {
if (inrepeat_)
++inrepeat_;
- if (inrepeat_ == 3 && isset(SHORTLOOPS))
+ if (inrepeat_ == 3 && (isset(SHORTLOOPS) || isset(SHORTREPEAT)))
incmdpos = 1;
tok = gettok();
} while (tok != ENDINPUT && exalias());
@@ -541,6 +541,17 @@ cmd_or_math_sub(void)
{
int c = hgetc(), ret;
+ if (c == '\\') {
+ c = hgetc();
+ if (c != '\n') {
+ hungetc(c);
+ hungetc('\\');
+ lexstop = 0;
+ return skipcomm() ? CMD_OR_MATH_ERR : CMD_OR_MATH_CMD;
+ }
+ c = hgetc();
+ }
+
if (c == '(') {
int lexpos = (int)(lexbuf.ptr - tokstr);
add(Inpar);
@@ -998,6 +1009,16 @@ gettokstr(int c, int sub)
break;
case LX2_STRING:
e = hgetc();
+ if (e == '\\') {
+ e = hgetc();
+ if (e != '\n') {
+ hungetc(e);
+ hungetc('\\');
+ lexstop = 0;
+ break;
+ }
+ e = hgetc();
+ }
if (e == '[') {
cmdpush(CS_MATHSUBST);
add(String);
@@ -1868,6 +1889,7 @@ exalias(void)
hwend();
if (interact && isset(SHINSTDIN) && !strin && incasepat <= 0 &&
tok == STRING && !nocorrect && !(inbufflags & INP_ALIAS) &&
+ !hist_is_in_word() &&
(isset(CORRECTALL) || (isset(CORRECT) && incmdpos)))
spckword(&tokstr, 1, incmdpos, 1);