From the documentation of string-width string
:
This function returns the width in columns of the string
string
, if it were displayed in the current buffer and the selected window.
For me this imply that (string-width "1\n12\n123")
should return 3
, while in reality it returns 6
.
I can accept this (even though in my opinion this behavior contradicts documentation), but I also would like to know if there is an easy way to find
the width in columns of the string
string
, if it were displayed in the current buffer and the selected window.
I can imagine implementation when I first split string with \n
, then find string-width
for each piece and take maximum, but, somehow, I don't like this solution very much.