From caebbded67195d7f234e620cadc25ec276f4abcc Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 6 Aug 2015 00:16:17 +0200 Subject: command: define-section with empty contents removes a section --- DOCS/man/input.rst | 2 ++ input/input.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 9ad3122d3d..58413d54e3 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -521,6 +521,8 @@ Input Commands that are Possibly Subject to Change ``input.conf`` file (except that using the section syntax in it is not allowed), including the need to separate bindings with a newline character. + If the ``contents`` parameter is an empty string, the section is removed. + The section with the name ``default`` is the normal input section. In general, input sections have to be enabled with the ``enable-section`` diff --git a/input/input.c b/input/input.c index 9b93a6ed51..c22ece8203 100644 --- a/input/input.c +++ b/input/input.c @@ -1016,7 +1016,7 @@ void mp_input_define_section(struct input_ctx *ictx, char *name, char *location, // Delete: struct cmd_bind_section *bs = get_bind_section(ictx, bstr0(name)); remove_binds(bs, builtin); - if (contents) { + if (contents && contents[0]) { // Redefine: parse_config(ictx, builtin, bstr0(contents), location, name); } else { -- cgit v1.2.3