Calling shell-forward-word in front of an incomplete quoted command
substitution causes a parser error to be printed, which is followed
by an incomplete redisplay:
$ "$(" ^A\e^F
bash: command substitution: line 2: unexpected EOF while looking
for matching `"'
even when the word is single-quoted:
$ '$(' ^A\e^F
bash: command substitution: line 3: unexpected EOF while looking
for matching `''
There might be a more general fix but this patch seems to work.
---
bashline.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/bashline.c b/bashline.c
index e4f9975b..94a67b62 100644
--- a/bashline.c
+++ b/bashline.c
@@ -1114,10 +1114,10 @@ bash_forward_shellword (int count, int key)
ADVANCE_CHAR (rl_line_buffer, slen, p);
break;
case '\'':
- p = skip_to_delim (rl_line_buffer, ++p, "'", SD_NOJMP);
+ p = skip_to_delim (rl_line_buffer, ++p, "'",
SD_NOJMP|SD_NOSKIPCMD);
break;
case '"':
- p = skip_to_delim (rl_line_buffer, ++p, "\"", SD_NOJMP);
+ p = skip_to_delim (rl_line_buffer, ++p, "\"",
SD_NOJMP|SD_COMPLETE);
break;
}
@@ -1145,10 +1145,10 @@ bash_forward_shellword (int count, int key)
ADVANCE_CHAR (rl_line_buffer, slen, p);
break;
case '\'':
- p = skip_to_delim (rl_line_buffer, ++p, "'", SD_NOJMP);
+ p = skip_to_delim (rl_line_buffer, ++p, "'",
SD_NOJMP|SD_NOSKIPCMD);
break;
case '"':
- p = skip_to_delim (rl_line_buffer, ++p, "\"", SD_NOJMP);
+ p = skip_to_delim (rl_line_buffer, ++p, "\"",
SD_NOJMP|SD_COMPLETE);
break;
}
--
2.51.0