From 2d5bb4c0f721af6f1c77a029efcbd3827b0adcae Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Wed, 30 Nov 2016 16:14:05 -0500 Subject: [PATCH] update xpick to print out the only option when only one line received --- xpick.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/xpick.c b/xpick.c index 4a8d070..30980ab 100644 --- a/xpick.c +++ b/xpick.c @@ -195,14 +195,16 @@ static void keyboard_input(int mods, uint32_t key) { int main(int argc, char** argv) { load_choices(); - /* initialize the filter edit buffer */ - buf_init(&Query); - /* initialize the display engine */ - x11_init(&Config); - x11_dialog("pick", Width, Height); - x11_show(); - Font = x11_font_load(FONTNAME); - x11_loop(); + if (vec_size(&Choices) > 1) { + /* initialize the filter edit buffer */ + buf_init(&Query); + /* initialize the display engine */ + x11_init(&Config); + x11_dialog("pick", Width, Height); + x11_show(); + Font = x11_font_load(FONTNAME); + x11_loop(); + } /* print out the choice */ if (vec_size(&Choices) && ChoiceIdx != SIZE_MAX) { Choice* choice = (Choice*)vec_at(&Choices, ChoiceIdx); -- 2.52.0