I need the count of lines given text occupies in a textarea. Thing is, this number is highly variable, changing depending on word wraps, tabs, font size etc. My rough solution disregards most of these, taking into account only newlines, fixed column count and assuming one tab per line. I'd much better like to write something better, but I have no idea how to get current width of textarea in columns. Any pointers, ideas, suggestions?