From 718837a76b21b9c6020c1e328ca8607a30afa7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 1 Jun 2017 23:10:46 +0200 Subject: [PATCH] fset: skip spaces at beginning of buffer input --- src/plugins/fset/fset-buffer.c | 9 ++++++++- src/plugins/fset/fset-command.c | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plugins/fset/fset-buffer.c b/src/plugins/fset/fset-buffer.c index b03f90a82..d7032b5d7 100644 --- a/src/plugins/fset/fset-buffer.c +++ b/src/plugins/fset/fset-buffer.c @@ -690,6 +690,7 @@ fset_buffer_input_cb (const void *pointer, void *data, { ",", "mark 1" }, { NULL, NULL } }; char str_command[64]; + const char *ptr_input; int i; /* make C compiler happy */ @@ -724,7 +725,13 @@ fset_buffer_input_cb (const void *pointer, void *data, } /* filter options with given text */ - fset_option_filter_options (input_data); + ptr_input = input_data; + while (ptr_input[0] == ' ') + { + ptr_input++; + } + if (ptr_input[0]) + fset_option_filter_options (ptr_input); return WEECHAT_RC_OK; } diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c index 5d9d82d9f..39230d803 100644 --- a/src/plugins/fset/fset-command.c +++ b/src/plugins/fset/fset-command.c @@ -545,7 +545,11 @@ fset_command_init () " shift+down mark/unmark option and move one line down\n" " shift+up mark/unmark option and move one line up\n" " $ refresh options, unmark all options\n" - " q close fset buffer"), + " q close fset buffer\n" + "\n" + "Note: spaces at beginning of input are ignored, so for example " + "\"q\" closes the fset buffer while \" q\" searches all options " + "with \"q\" inside name."), "-bar" " || -refresh" " || -up 1|2|3|4|5"