From 91ae39008a68926972de66521b63837589f7d6cc Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 23 Sep 2017 13:06:44 -0700 Subject: [PATCH] Correct prefix length calculation in completion measurement A completion may have zero length; in this case the length of the prefix was omitted and the completion was not visible. Correct the calculation to account for zero-width completions. Fixes #4424 --- src/pager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pager.cpp b/src/pager.cpp index c53e928fe..0f0151e90 100644 --- a/src/pager.cpp +++ b/src/pager.cpp @@ -328,7 +328,7 @@ void pager_t::measure_completion_infos(comp_info_list_t *infos, const wcstring & // fish_wcswidth() can return -1 if it can't calculate the width. So be cautious. int comp_width = fish_wcswidth(comp_strings.at(j).c_str()); - if (comp_width > 0) comp->comp_width += prefix_len + comp_width; + if (comp_width >= 0) comp->comp_width += prefix_len + comp_width; } // fish_wcswidth() can return -1 if it can't calculate the width. So be cautious.