commit 14291de3b2d18ecf647f9a7363d2286a3782d721 from: Omar Polo date: Tue Jul 03 07:47:43 2018 UTC fixed subtle bug related to first_selected + drawing at the end of the loop commit - 8b92991808127e109d39ff91f72dc67a5a3d93f5 commit + 14291de3b2d18ecf647f9a7363d2286a3782d721 blob - 8cb4b79f1fb61189a557dd51b549b8b58fbe5f9f blob + 71c4aad0fc4e5a2bbf7616616d97d498337d80a9 --- mymenu.c +++ mymenu.c @@ -1204,8 +1204,17 @@ int main(int argc, char **argv) { case CONFIRM: status = OK; - if (first_selected) { - complete(cs, first_selected, false, &text, &textlen, &status); + + // if first_selected is active and the first completion is + // active be sure to 'expand' the text to match the selection + if (first_selected && cs->selected) { + free(text); + text = strdup(cs->completion); + if (text == nil) { + fprintf(stderr, "Memory allocation error"); + status = ERR; + } + textlen = strlen(text); } break; @@ -1268,14 +1277,17 @@ int main(int argc, char **argv) { free(input); } } + + break; } + } - draw(&r, text, cs); - break; default: fprintf(stderr, "Unknown event %d\n", e.type); } + + draw(&r, text, cs); } if (status == OK)