From 94bdf92a06df1aaa1881b14dd7244900222f0551 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 8 Jan 2007 22:05:54 +0000 Subject: 23097: splitting of $'...' strings in completion --- Src/lex.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'Src/lex.c') diff --git a/Src/lex.c b/Src/lex.c index a568e25c4..7a0bf2b1c 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -96,18 +96,18 @@ mod_export int addedx; mod_export int wb, we; /* 1 if aliases should not be expanded */ - + /**/ mod_export int noaliases; /* we are parsing a line sent to use by the editor */ - + /**/ mod_export int zleparse; - + /**/ mod_export int wordbeg; - + /**/ mod_export int parbegin; @@ -115,7 +115,7 @@ mod_export int parbegin; mod_export int parend; /* don't recognize comments */ - + /**/ mod_export int nocomments; @@ -1181,10 +1181,20 @@ gettokstr(int c, int sub) STOPHIST while ((c = hgetc()) != '\'' && !lexstop) { if (strquote && c == '\\') { - add(c); c = hgetc(); if (lexstop) break; + /* + * Mostly we don't need to do anything special + * with escape backslashes or closing quotes + * inside $'...'; however in completion we + * need to be able to strip multiple backslashes + * neatly. + */ + if (c == '\\' || c == '\'') + add(Bnull); + else + add('\\'); } else if (!sub && isset(CSHJUNKIEQUOTES) && c == '\n') { if (bptr[-1] == '\\') bptr--, len--; -- cgit 1.4.1