I’ve looked for a way (built in) to perform a word count on a selection but cannot find one. So I looked for a macro and found none. I know I’m not the only one who uses Komodo for writing as well as coding. Can someone point me in the right direction?
I need to select a quantity of text and perform an estimated word count (much like the despised MSWord does).
Defman: tip - use regex to do your split, so you can account for repeat whitespace:
alert(require("ko/editor").getSelection().split(/\s+/).length + " words in the selection");
Note that does not address whitespace in front or at the end of the selection, its not a reliable way of giving the word count. Better would be something like: