reader: Stringify completion_apply_to_command_line

This commit is contained in:
Fabian Homborg 2018-10-20 22:35:04 +02:00
parent 410e13dd74
commit 6bc2e15953

View File

@ -1166,10 +1166,9 @@ static bool insert_char(editable_line_t *el, wchar_t c, bool allow_expand_abbrev
/// characters. This is used to determine whether we go inside a trailing quote. /// characters. This is used to determine whether we go inside a trailing quote.
/// ///
/// \return The completed string /// \return The completed string
wcstring completion_apply_to_command_line(const wcstring &val_str, complete_flags_t flags, wcstring completion_apply_to_command_line(const wcstring &val, complete_flags_t flags,
const wcstring &command_line, size_t *inout_cursor_pos, const wcstring &command_line, size_t *inout_cursor_pos,
bool append_only) { bool append_only) {
const wchar_t *val = val_str.c_str();
bool add_space = !bool(flags & COMPLETE_NO_SPACE); bool add_space = !bool(flags & COMPLETE_NO_SPACE);
bool do_replace = bool(flags & COMPLETE_REPLACES_TOKEN); bool do_replace = bool(flags & COMPLETE_REPLACES_TOKEN);
bool do_escape = !bool(flags & COMPLETE_DONT_ESCAPE); bool do_escape = !bool(flags & COMPLETE_DONT_ESCAPE);
@ -1195,7 +1194,7 @@ wcstring completion_apply_to_command_line(const wcstring &val_str, complete_flag
move_cursor = escaped.size(); move_cursor = escaped.size();
} else { } else {
sb.append(val); sb.append(val);
move_cursor = wcslen(val); move_cursor = val.length();
} }
if (add_space) { if (add_space) {
@ -1227,7 +1226,7 @@ wcstring completion_apply_to_command_line(const wcstring &val_str, complete_flag
} }
} }
replaced = parse_util_escape_string_with_quote(val_str, quote, no_tilde); replaced = parse_util_escape_string_with_quote(val, quote, no_tilde);
} else { } else {
replaced = val; replaced = val;
} }