lipgloss icon indicating copy to clipboard operation
lipgloss copied to clipboard

feat: add Widest for returning the widest member of a string slice

Open meowgorithm opened this issue 2 years ago • 3 comments

An additional utility function. Not totally sure if this should be merged yet, but I find myself doing this a lot.

meowgorithm avatar Jun 20 '23 14:06 meowgorithm

I think this should probably go in charmbracelet/x.

maaslalani avatar Oct 12 '23 05:10 maaslalani

@aymanbagabas What do you think about making an ANSI-aware function of this in x/term? I also found myself needing this at some points.

maaslalani avatar Mar 14 '24 15:03 maaslalani

@aymanbagabas What do you think about making an ANSI-aware function of this in x/term? I also found myself needing this at some points.

Hey @maaslalani, this PR updates the Width method to use ansi.StringWidth to calculate the width. However I still think something like lipgloss.Widest is still beneficial.

aymanbagabas avatar Mar 15 '24 14:03 aymanbagabas