uranusjr/macdown — pull request #52 by Mowsh (2014-07-06 21:07:51+00:00)
Title: Added word count

This word count can be turned on and off in the general section of the preferences under behaviour. I've used a word count style similar to that of other mac apps such as Pages, as I always thought Mou's word count was a little strange.

![image](https://cloud.githubusercontent.com/assets/1332090/3489936/208bdcc8-0550-11e4-91ea-55061ad2fbf1.png)

You can click the counter to cycle through three different modes: word count, character count and character count without spaces. The code to get the word count and character count without spaces could probably be a lot more efficient, so right now the word count is only calculated if the document hasn't changed for 0.5 seconds.

This is a bit of a work in progress as I'd like to hear your opinion on what I've done.

* Should this counter be in the top right corner like Mou's counter?
* The counter is sometimes on top of text, Pages "fixes" this by making the counter slightly transparent, I think the NSTextView should have some extra padding only on the bottom, which only seems possible by subclassing NSTextView.
* There's probably a faster way of calculating the word/character count. I tried `[[self.editor.textstorage words] length]`, but this would sometimes return trash. (this might just be a bug with my Yosemite though)