mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
fix regression introduced by commit 851e449
My earlier attempt with commit 851e449
to eliminate all the compiler
warnings about mixing signed and unsigned ints in an expression
introduced a subtle bug. This fixes that mistake.
Fixes #3488
This commit is contained in:
parent
2bb52c65c2
commit
075be74cc4
2 changed files with 7 additions and 7 deletions
|
@ -84,16 +84,15 @@ static int print_max(const wcstring &str, highlight_spec_t color, int max, bool
|
||||||
|
|
||||||
/// Print the specified item using at the specified amount of space.
|
/// Print the specified item using at the specified amount of space.
|
||||||
line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, size_t row,
|
line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, size_t row,
|
||||||
size_t column, size_t width, bool secondary, bool selected,
|
size_t column, int width, bool secondary, bool selected,
|
||||||
page_rendering_t *rendering) const {
|
page_rendering_t *rendering) const {
|
||||||
UNUSED(column);
|
UNUSED(column);
|
||||||
UNUSED(row);
|
UNUSED(row);
|
||||||
UNUSED(rendering);
|
UNUSED(rendering);
|
||||||
size_t comp_width = 0, desc_width = 0;
|
int comp_width, desc_width;
|
||||||
size_t written = 0;
|
|
||||||
line_t line_data;
|
line_t line_data;
|
||||||
|
|
||||||
if (c->pref_width <= (size_t)width) {
|
if (c->pref_width <= width) {
|
||||||
// The entry fits, we give it as much space as it wants.
|
// The entry fits, we give it as much space as it wants.
|
||||||
comp_width = c->comp_width;
|
comp_width = c->comp_width;
|
||||||
desc_width = c->desc_width;
|
desc_width = c->desc_width;
|
||||||
|
@ -102,8 +101,8 @@ line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, s
|
||||||
// the space to the completion, and whatever is left to the description.
|
// the space to the completion, and whatever is left to the description.
|
||||||
int desc_all = c->desc_width ? c->desc_width + 4 : 0;
|
int desc_all = c->desc_width ? c->desc_width + 4 : 0;
|
||||||
|
|
||||||
comp_width = maxi(mini(c->comp_width, 2 * (width - 4) / 3), width - desc_all);
|
comp_width = maxi(mini((int)c->comp_width, 2 * (width - 4) / 3), width - desc_all);
|
||||||
if (c->desc_width) desc_width = width - comp_width - 4;
|
desc_width = c->desc_width ? width - 4 - comp_width : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bg_color = secondary ? highlight_spec_pager_secondary : highlight_spec_normal;
|
int bg_color = secondary ? highlight_spec_pager_secondary : highlight_spec_normal;
|
||||||
|
@ -111,6 +110,7 @@ line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, s
|
||||||
bg_color = highlight_spec_search_match;
|
bg_color = highlight_spec_search_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int written = 0;
|
||||||
for (size_t i = 0; i < c->comp.size(); i++) {
|
for (size_t i = 0; i < c->comp.size(); i++) {
|
||||||
const wcstring &comp = c->comp.at(i);
|
const wcstring &comp = c->comp.at(i);
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ class pager_t {
|
||||||
const wcstring &prefix, const comp_info_list_t &lst,
|
const wcstring &prefix, const comp_info_list_t &lst,
|
||||||
page_rendering_t *rendering) const;
|
page_rendering_t *rendering) const;
|
||||||
line_t completion_print_item(const wcstring &prefix, const comp_t *c, size_t row, size_t column,
|
line_t completion_print_item(const wcstring &prefix, const comp_t *c, size_t row, size_t column,
|
||||||
size_t width, bool secondary, bool selected,
|
int width, bool secondary, bool selected,
|
||||||
page_rendering_t *rendering) const;
|
page_rendering_t *rendering) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue