summaryrefslogtreecommitdiffstats
path: root/cmd-parse.y
diff options
context:
space:
mode:
authornicm <nicm>2023-03-15 08:15:39 +0000
committernicm <nicm>2023-03-15 08:15:39 +0000
commitac4bb89d4355a7a9bd2abe4cb27b31a445f7cd99 (patch)
tree07062e95a82e0e9aa01d6654e64a90f75af75454 /cmd-parse.y
parent907f58cc3c2c76184dfd06129902b2147a2e4c5b (diff)
Fix command prompt not to always append argument but only if there has
actually been expansion. GitHub issue 3493.
Diffstat (limited to 'cmd-parse.y')
-rw-r--r--cmd-parse.y17
1 files changed, 14 insertions, 3 deletions
diff --git a/cmd-parse.y b/cmd-parse.y
index cdf026f3..65ffad84 100644
--- a/cmd-parse.y
+++ b/cmd-parse.y
@@ -1615,13 +1615,24 @@ yylex_token(int ch)
for (;;) {
/* EOF or \n are always the end of the token. */
- if (ch == EOF || (state == NONE && ch == '\n'))
+ if (ch == EOF) {
+ log_debug("%s: end at EOF", __func__);
+ break;
+ }
+ if (state == NONE && ch == '\n') {
+ log_debug("%s: end at EOL", __func__);
break;
+ }
/* Whitespace or ; or } ends a token unless inside quotes. */
- if ((ch == ' ' || ch == '\t' || ch == ';' || ch == '}') &&
- state == NONE)
+ if (state == NONE && (ch == ' ' || ch == '\t')) {
+ log_debug("%s: end at WS", __func__);
break;
+ }
+ if (state == NONE && (ch == ';' || ch == '}')) {
+ log_debug("%s: end at %c", __func__, ch);
+ break;
+ }
/*
* Spaces and comments inside quotes after \n are removed but