From 55d77ed216607dfc2d31f9a46c2564e333ee1b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 5 Apr 2014 18:43:11 +0200 Subject: core: add option -all for command /buffer hide|unhide --- src/core/wee-command.c | 64 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 26 deletions(-) (limited to 'src/core') diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 8872a824c..1aa79b784 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -770,25 +770,30 @@ COMMAND_CALLBACK(buffer) { if (argc > 2) { - for (i = 2; i < argc; i++) + if (string_strcasecmp (argv[2], "-all") == 0) + gui_buffer_hide_all (); + else { - ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]); - if (ptr_buffer) + for (i = 2; i < argc; i++) { - number = strtol (argv[2], &error, 10); - if (error && !error[0]) + ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]); + if (ptr_buffer) { - for (ptr_buffer2 = gui_buffers; ptr_buffer2; - ptr_buffer2 = ptr_buffer2->next_buffer) + number = strtol (argv[2], &error, 10); + if (error && !error[0]) { - if (ptr_buffer2->number == ptr_buffer->number) + for (ptr_buffer2 = gui_buffers; ptr_buffer2; + ptr_buffer2 = ptr_buffer2->next_buffer) { - gui_buffer_hide (ptr_buffer2); + if (ptr_buffer2->number == ptr_buffer->number) + { + gui_buffer_hide (ptr_buffer2); + } } } + else + gui_buffer_hide (ptr_buffer); } - else - gui_buffer_hide (ptr_buffer); } } } @@ -803,25 +808,30 @@ COMMAND_CALLBACK(buffer) { if (argc > 2) { - for (i = 2; i < argc; i++) + if (string_strcasecmp (argv[2], "-all") == 0) + gui_buffer_unhide_all (); + else { - ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]); - if (ptr_buffer) + for (i = 2; i < argc; i++) { - number = strtol (argv[2], &error, 10); - if (error && !error[0]) + ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]); + if (ptr_buffer) { - for (ptr_buffer2 = gui_buffers; ptr_buffer2; - ptr_buffer2 = ptr_buffer2->next_buffer) + number = strtol (argv[2], &error, 10); + if (error && !error[0]) { - if (ptr_buffer2->number == ptr_buffer->number) + for (ptr_buffer2 = gui_buffers; ptr_buffer2; + ptr_buffer2 = ptr_buffer2->next_buffer) { - gui_buffer_unhide (ptr_buffer2); + if (ptr_buffer2->number == ptr_buffer->number) + { + gui_buffer_unhide (ptr_buffer2); + } } } + else + gui_buffer_unhide (ptr_buffer); } - else - gui_buffer_unhide (ptr_buffer); } } } @@ -6747,8 +6757,8 @@ command_init () " || swap | [|]" " || merge " " || unmerge [|-all]" - " || hide [| [|...]]" - " || unhide [| [|...]]" + " || hide [||-all [|...]]" + " || unhide [||-all [|...]]" " || renumber [ [ []]]" " || close [[-]|]" " || notify " @@ -6821,8 +6831,10 @@ command_init () " || swap %(buffers_numbers)" " || merge %(buffers_numbers)" " || unmerge %(buffers_numbers)|-all" - " || hide %(buffers_numbers)|%(buffers_plugins_names)|%*" - " || unhide %(buffers_numbers)|%(buffers_plugins_names)|%*" + " || hide %(buffers_numbers)|%(buffers_plugins_names)|-all " + "%(buffers_numbers)|%(buffers_plugins_names)|%*" + " || unhide %(buffers_numbers)|%(buffers_plugins_names)|-all " + "%(buffers_numbers)|%(buffers_plugins_names)|%*" " || renumber %(buffers_numbers) %(buffers_numbers) %(buffers_numbers)" " || close %(buffers_plugins_names)" " || list" -- cgit v1.2.3