Re: [hackers] [dmenu] Partially revert 44c7de3: fix items text width offset calculation

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Mon, 25 Jul 2016 19:59:43 +0200

On Mon, Jul 25, 2016 at 11:33:25AM +0200, Quentin Rameau wrote:
> Without this, we discard the item if it's longer than assigned width
> instead of truncating it.
> ---
> dmenu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/dmenu.c b/dmenu.c
> index e926eca..8e84fbd 100644
> --- a/dmenu.c
> +++ b/dmenu.c
> _AT_@ -81,10 +81,10 @@ calcoffsets(void)
> n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
> /* calculate which items will begin the next page and previous page */
> for (i = 0, next = curr; next; next = next->right)
> - if ((i += (lines > 0) ? bh : TEXTW(next->text)) > n)
> + if ((i += (lines > 0) ? bh : MIN(TEXTW(next->text), n)) > n)
> break;
> for (i = 0, prev = curr; prev && prev->left; prev = prev->left)
> - if ((i += (lines > 0) ? bh : TEXTW(prev->left->text)) > n)
> + if ((i += (lines > 0) ? bh : MIN(TEXTW(prev->left->text), n)) > n)
> break;
> }
>
> --
> 2.9.0
>
>

Applied, thanks as always :>

-- 
Kind regards,
Hiltjo
Received on Mon Jul 25 2016 - 19:59:43 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 25 2016 - 20:12:14 CEST