From: Olivier Matz Date: Sun, 8 May 2011 15:32:49 +0000 (+0200) Subject: cmdline: display prompt and previous command after pager X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=4e84906b2e9f8ac170ed711b2d0d8c22e82b6adf;p=libcmdline.git cmdline: display prompt and previous command after pager Signed-off-by: Olivier Matz --- diff --git a/src/lib/cmdline_rdline.c b/src/lib/cmdline_rdline.c index d0a116e..5ff851b 100644 --- a/src/lib/cmdline_rdline.c +++ b/src/lib/cmdline_rdline.c @@ -214,28 +214,28 @@ rdline_parse_char(struct rdline *rdl, char c) #ifndef NO_PAGER /* display asynchrounous printf if any */ if (rdl->pager_buf != NULL) { + /* user ask to exit pager */ if (cmd == VT100_STD_CHAR && c == 'q') { - rdline_printf(rdl, vt100_home); - rdline_printf(rdl, vt100_clear_right); rdline_asyncpager_reset(rdl); if (rdl->pager_cb != NULL) { rdl->pager_cb(rdl, rdl->pager_arg); rdl->pager_cb = NULL; } - if (rdl->pager_buf == NULL) - return RDLINE_RES_VALIDATED; + rdline_redisplay(rdl); + return RDLINE_RES_SUCCESS; } - if (rdline_pager_next_page(rdl) == 0) { + /* last page is displayed */ + else if (rdline_pager_next_page(rdl) == 0) { rdline_asyncpager_reset(rdl); if (rdl->pager_cb != NULL) { rdl->pager_cb(rdl, rdl->pager_arg); rdl->pager_cb = NULL; } - if (rdl->pager_buf == NULL) - return RDLINE_RES_VALIDATED; + rdline_redisplay(rdl); } - /* async printf was called in cb() */ + + /* pages remain, async printf was called in cb() */ return RDLINE_RES_SUCCESS; } #endif