1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-14 21:53:14 +03:00

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)
This commit is contained in:
Johannes Altmanninger 2022-07-19 23:07:59 +02:00
parent 4b6abfaedf
commit 23fcf77160

View File

@ -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 "";