When I use the print method to show a text, I would like: if the size of the string is larger than the size of one line in the terminal, then perform an action, like cut the string or change it.
How can I get the current size of the terminal (I mean in term of characters, not pixels)
some additions: size from zsh, size from tmux, size from CSI 18t escape sequence (i.e. ask the terminal for the size), dependency on Readline is optional (GNU GPL 3 without linking exception)
IIRC I needed to normalize to NFKC first and then use UnicodeCharWidth.truncate from https://github.com/naqvis/uni_char_width for the calculation of the width to be correct.
It was great to know about uni_char_width in this thread.
Thanks to it, I can now display cowsay more nicely than before. I would like to add Crys someday.