From: Michael D. Lowis Date: Wed, 30 Nov 2016 21:14:05 +0000 (-0500) Subject: update xpick to print out the only option when only one line received X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=2d5bb4c0f721af6f1c77a029efcbd3827b0adcae;p=projs%2Ftide.git update xpick to print out the only option when only one line received --- 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);