mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
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
This commit is contained in:
parent
0d93125664
commit
43d0016125
1 changed files with 1 additions and 1 deletions
|
@ -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.
|
// 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());
|
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.
|
// fish_wcswidth() can return -1 if it can't calculate the width. So be cautious.
|
||||||
|
|
Loading…
Reference in a new issue