aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Luke <chrisy@flirble.org>2018-06-10 10:47:50 -0400
committerFlorin Coras <florin.coras@gmail.com>2018-06-10 16:32:32 +0000
commit70a745d96653c2d3e72ba1704c29aaa946ed9a92 (patch)
treec4cc737fe03264b0a51a915db9a8e8fdb7179b80 /src
parent5313adc02a1f658268935a940bb706846f6e78e9 (diff)
cli: Fix off-by-one in the pager
- The last line in the pager buffer was sometimes missed when using space/pg-dn; simple off-by-one error. Change-Id: Id4e5f7cf0e5db4f719f87b9069d75427bc66d3f7 Signed-off-by: Chris Luke <chrisy@flirble.org>
Diffstat (limited to 'src')
-rw-r--r--src/vlib/unix/cli.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 3df9a98ffb1..512a77aa8f7 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -1832,7 +1832,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
case UNIX_CLI_PARSE_ACTION_PAGER_NEXT:
case UNIX_CLI_PARSE_ACTION_PAGER_PGDN:
/* show next page of the buffer */
- if (cf->height + cf->pager_start < vec_len (cf->pager_index))
+ if (cf->height + cf->pager_start <= vec_len (cf->pager_index))
{
u8 *line = NULL;
unix_cli_pager_index_t *pi = NULL;
@@ -1863,7 +1863,7 @@ unix_cli_line_process_one (unix_cli_main_t * cm,
case UNIX_CLI_PARSE_ACTION_PAGER_DN:
case UNIX_CLI_PARSE_ACTION_PAGER_CRLF:
/* display the next line of the buffer */
- if (cf->pager_start < vec_len (cf->pager_index) - (cf->height - 1))
+ if (cf->height + cf->pager_start <= vec_len (cf->pager_index))
{
u8 *line;
unix_cli_pager_index_t *pi;