To calculate input string/text length (total of characters and spaces) and display the first X characters (inc. spaces)

Note that, for text pasted into the box, one count is also added at the end of each line-break and for each empty line, presumably because the text is aggregated into a single string* with spaces for each of these 'items'. (Pressing spacebar multiple times at end lines or within empty lines also adds to total.) I may try to control these aspects in another version, especially if making a word-count feature in addition. (*For this reason also, the "first X letters" output does not show paragraph breaks. Again, I might investigate whether that can be altered by getting the script to recognise these, though that would presumably depend on text encoding.)