From a584fc51d92ecbe7d6f1b7b22b493582fbe37c7e Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 28 Jul 2022 10:38:28 +0200 Subject: [PATCH] Explain edge case in select_completion_in_direction() No functional change. --- src/pager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pager.cpp b/src/pager.cpp index 440293655..02f121aad 100644 --- a/src/pager.cpp +++ b/src/pager.cpp @@ -750,7 +750,10 @@ bool pager_t::select_next_completion_in_direction(selection_motion_t direction, // rendering.cols is the first suggested visible completion; add the visible completion // count to that to get the last one. size_t visible_row_count = rendering.row_end - rendering.row_start; - if (visible_row_count == 0 || selected_completion_idx == PAGER_SELECTION_NONE) { + if (visible_row_count == 0) { + return true; // this happens if there was no room to draw the pager + } + if (selected_completion_idx == PAGER_SELECTION_NONE) { return true; // this should never happen but be paranoid }