From 63f42e45070c407d71cf451a42d6725273c5e3a4 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Mon, 12 Mar 2018 21:41:29 +0100 Subject: [PATCH] remove debug and clarify help display --- lib/main-readline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main-readline.c b/lib/main-readline.c index 8b8a094..0f6abb2 100644 --- a/lib/main-readline.c +++ b/lib/main-readline.c @@ -114,7 +114,6 @@ static char *get_node_help(const struct ec_completed_item *item) grp = ec_completed_item_get_grp(item); state = grp->state; - ec_parsed_dump(stdout, ec_parsed_get_root(state)); for (state = grp->state; state != NULL; state = ec_parsed_get_parent(state)) { node = ec_parsed_get_node(state); @@ -146,6 +145,7 @@ static int show_help(int ignore, int invoking_key) unsigned int count; char **helps = NULL; int match = 0; + int cols; (void)ignore; (void)invoking_key; @@ -169,8 +169,6 @@ static int show_help(int ignore, int invoking_key) if (c == NULL) goto fail; - ec_completed_dump(stdout, c); - /* let's display one contextual help per node */ count = 0; iter = ec_completed_iter(c, @@ -205,7 +203,9 @@ static int show_help(int ignore, int invoking_key) ec_completed_iter_free(iter); ec_completed_free(c); - rl_display_match_list(helps, count + match, 1000); /* XXX 1000 */ + /* ensure not more than 1 entry per line */ + rl_get_screen_size(NULL, &cols); + rl_display_match_list(helps, count + match, cols); rl_forced_update_display(); return 0; -- 2.20.1