diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2021-08-09 22:13:31 +0200 |
|---|---|---|
| committer | Johannes Altmanninger <aclopte@gmail.com> | 2021-08-09 22:46:06 +0200 |
| commit | abd833e0dc8da8c21a6bab7f95465fc1f25f2cf7 (patch) | |
| tree | af248ed2cc035671fd41820d727e00b963e2c607 /src/command_manager.cc | |
| parent | 580869fd49e7bef7126b85c143dfca111704eda6 (diff) | |
Restore prompt completion for "%opt{"
Commit 2289f350 ("Remove command parsing Reader and just track a
ParserState") introduced a small regression in parse_percent_token()
because we failed to recognize a token like %val{ as percent-expansion.
I tried to add a test case but a UI test doesn't seem possible, e.g.
kak -ui json -e "exec ':echo %opt{<tab>}<ret>'"
prints: 'exec': option not found: ''
Diffstat (limited to 'src/command_manager.cc')
| -rw-r--r-- | src/command_manager.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc index 32c25322..2c067978 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -245,8 +245,9 @@ Token parse_percent_token(ParseState& state, bool throw_on_unterminated) ++state.pos; StringView type_name{type_start, state.pos}; + bool at_end = state.pos == state.str.end(); const Codepoint opening_delimiter = utf8::read_codepoint(state.pos, state.str.end()); - if (not state or iswalpha(opening_delimiter)) + if (at_end or iswalpha(opening_delimiter)) { if (throw_on_unterminated) throw parse_error{format("expected a string delimiter after '%{}'", |
