diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2022-07-19 23:07:59 +0200 |
|---|---|---|
| committer | Johannes Altmanninger <aclopte@gmail.com> | 2022-07-28 15:02:20 +0200 |
| commit | 23fcf771608fe48d548930fe0097286fbace1ef4 (patch) | |
| tree | 72cb0e0fdec229109959e6ce9d24bbedcc1cd7b9 /src | |
| parent | 4b6abfaedf05a232e4737d85c62e0c01e7550203 (diff) | |
Fix autoinfo for "set-option -remove" not showing option-specific info
On a command prompt like
"set-option -remove buffer aligntab "
we fail to show the aligntab-specific info . Fix this by skipping a
leading -remove, just like we skip -add.
Add an explicit specialization of contains() because otherwise I'd
need to write something like
contains(Array{"-add", "remove"}, param)
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/commands.cc b/src/commands.cc index f08acb34..f8b9f9f9 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1631,11 +1631,11 @@ const CommandDesc source_cmd = { static String option_doc_helper(const Context& context, CommandParameters params) { - const bool add = params.size() > 1 and params[0] == "-add"; - if (params.size() < 2 + (add ? 1 : 0)) + const bool is_switch = params.size() > 1 and (params[0] == "-add" or params[0] == "-remove"); + if (params.size() < 2 + (is_switch ? 1 : 0)) return ""; - auto desc = GlobalScope::instance().option_registry().option_desc(params[1 + (add ? 1 : 0)]); + auto desc = GlobalScope::instance().option_registry().option_desc(params[1 + (is_switch ? 1 : 0)]); if (not desc or desc->docstring().empty()) return ""; |
