diff options
| author | Andrés González <gonzalez.af@gmail.com> | 2022-04-19 18:36:32 -0400 |
|---|---|---|
| committer | Andrés González <gonzalez.af@gmail.com> | 2022-04-19 18:36:32 -0400 |
| commit | 384d89ba7a8a99ea4efa8e05354c3ff0e40bb3c5 (patch) | |
| tree | 487a1a092ab96111249d405d4ffd39124bbd0208 /src | |
| parent | abc36547659da77c0c576329fc0c1b1d1c40c677 (diff) | |
| parent | fbf1d98e58690614a20929b4fe76876939eb2d5d (diff) | |
Merge branch 'master' of github.com:in0ni/kakoune
Diffstat (limited to 'src')
| -rw-r--r-- | src/command_manager.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc index 0f3cb749..b8784093 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -132,7 +132,7 @@ ParseResult parse_quoted(ParseState& state, Delimiter delimiter) if (c == delimiter) { auto next = state.pos; - if (read(next, end) != delimiter) + if (next == end || read(next, end) != delimiter) { if (str.empty()) return {String{String::NoCopy{}, {beg, cur}}, true}; @@ -815,15 +815,20 @@ UnitTest test_command_parsing{[] { auto check_quoted = [](StringView str, bool terminated, StringView content) { - ParseState state{str, str.begin()}; - const Codepoint delimiter = *state.pos++; - auto quoted = parse_quoted(state, delimiter); - kak_assert(quoted.terminated == terminated); - kak_assert(quoted.content == content); + auto check_quoted_impl = [&](auto type_hint) { + ParseState state{str, str.begin()}; + const decltype(type_hint) delimiter = *state.pos++; + auto quoted = parse_quoted(state, delimiter); + kak_assert(quoted.terminated == terminated); + kak_assert(quoted.content == content); + }; + check_quoted_impl(Codepoint{}); + check_quoted_impl(char{}); }; check_quoted("'abc'", true, "abc"); check_quoted("'abc''def", false, "abc'def"); check_quoted("'abc''def'''", true, "abc'def'"); + check_quoted(StringView("'abc''def'", 5), true, "abc"); auto check_balanced = [](StringView str, bool terminated, StringView content) { |
