mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
Remove triggerable assert in unescape_string_internal
Fixes #4954 - in a hacky way.
This commit is contained in:
parent
e02e485cc6
commit
baeeef3233
2 changed files with 8 additions and 1 deletions
|
@ -1363,7 +1363,11 @@ static bool unescape_string_internal(const wchar_t *const input, const size_t in
|
||||||
}
|
}
|
||||||
case L'}': {
|
case L'}': {
|
||||||
if (unescape_special) {
|
if (unescape_special) {
|
||||||
assert(brace_count > 0 && "imbalanced brackets are a tokenizer error, we shouldn't be able to get here");
|
// HACK: The completion machinery sometimes hands us partial tokens.
|
||||||
|
// We can't parse them properly, but it shouldn't hurt,
|
||||||
|
// so we don't assert here.
|
||||||
|
// See #4954.
|
||||||
|
// assert(brace_count > 0 && "imbalanced brackets are a tokenizer error, we shouldn't be able to get here");
|
||||||
brace_count--;
|
brace_count--;
|
||||||
brace_text_start = brace_text_start && brace_count > 0;
|
brace_text_start = brace_text_start && brace_count > 0;
|
||||||
to_append_or_none = BRACE_END;
|
to_append_or_none = BRACE_END;
|
||||||
|
|
|
@ -1078,6 +1078,9 @@ void completer_t::complete_param_expand(const wcstring &str, bool do_file,
|
||||||
bool complete_from_start = !complete_from_separator || !string_prefixes_string(L"-", str);
|
bool complete_from_start = !complete_from_separator || !string_prefixes_string(L"-", str);
|
||||||
|
|
||||||
if (complete_from_separator) {
|
if (complete_from_separator) {
|
||||||
|
// FIXME: This just cuts the token,
|
||||||
|
// so any quoting or braces gets lost.
|
||||||
|
// See #4954.
|
||||||
const wcstring sep_string = wcstring(str, sep_index + 1);
|
const wcstring sep_string = wcstring(str, sep_index + 1);
|
||||||
std::vector<completion_t> local_completions;
|
std::vector<completion_t> local_completions;
|
||||||
if (expand_string(sep_string, &local_completions, flags, NULL) == EXPAND_ERROR) {
|
if (expand_string(sep_string, &local_completions, flags, NULL) == EXPAND_ERROR) {
|
||||||
|
|
Loading…
Reference in a new issue