Ticket #4807 (reopened enhancement)

Opened 9 months ago

Last modified 3 weeks ago

Word Count

Reported by: mdawaffe Assigned to: mdawaffe
Priority: normal Milestone: 2.6
Component: Administration Version: 2.3
Severity: minor Keywords: has-patch blessed
Cc:

Description

Add word count thingummy to the Write Post screen. Should work in Visual view, Code view and tinyMCE-just-plain-off view.

Patch accomplishes this in Firefox, Safari, IE6/7, Opera.

Is it core?

Attachments

4807.diff (3.3 kB) - added by mdawaffe on 08/24/07 06:53:21.
4807b.diff (3.5 kB) - added by mdawaffe on 09/06/07 19:00:49.
patch update: this is what's currently running on WP.com
word-count.patch (6.5 kB) - added by azaozz on 04/17/08 19:44:27.
word-count2.patch (6.6 kB) - added by azaozz on 04/22/08 01:51:07.
word-count3.patch (6.4 kB) - added by azaozz on 04/24/08 00:07:19.
word-count3.2.patch (6.3 kB) - added by azaozz on 04/24/08 01:51:02.

Change History

08/24/07 06:53:21 changed by mdawaffe

  • attachment 4807.diff added.

08/24/07 07:25:28 changed by Stevie212

  • priority changed from normal to low.
  • severity changed from normal to trivial.

Try the ideas section to pledge your idea, Go here It's trivial if we need it or not, thats why I am changing it to "low" however it is a good idea.

08/24/07 08:47:23 changed by Viper007Bond

-1

I don't really see the point. I mean who cares how many words are in your post? I bet 99% of people don't.

Best left to a plugin IMO.

08/24/07 11:40:52 changed by rob1n

I'm on the fence with this one. While it's cool and I can definitely see the use (and I'd probably pay attention to it when I'm writing a post), I question whether it's really something that a wide range of users will use. But then again, it's unobtrusive enough that I also can't decide if it's plugin material or just a trivial addition to the core.

08/24/07 22:44:02 changed by rob1n

  • keywords set to has-patch 2nd-opinion.

09/06/07 03:58:04 changed by JeremyVisser

+1. WordPress.com has this feature.

(follow-up: ↓ 7 ) 09/06/07 04:52:17 changed by jaroche

-1.

Really, i don't see why have this in wordpress editor. If i wanna have a word counter and other goodies, I gonna use a real word procesor.

(in reply to: ↑ 6 ) 09/06/07 07:46:07 changed by JeremyVisser

Replying to jaroche:

Really, i don't see why have this in wordpress editor. If i wanna have a word counter and other goodies, I gonna use a real word procesor.

That's true. Word count is a small feature of a word processor. If we include word counting, then we're showing favouritism by not also turning it into a mini word processor.

(Oh boy, I wrote 'word processor' twice. Both times, I actually wrote 'WordPress', then had to hit backspace and correct it.) :)

09/06/07 19:00:49 changed by mdawaffe

  • attachment 4807b.diff added.

patch update: this is what's currently running on WP.com

09/06/07 19:03:05 changed by mdawaffe

  • owner changed from anonymous to mdawaffe.
  • status changed from new to assigned.

Patch updated.

As an aside, since this is completly JS, the feature can be easily disabled by plugin with the following.

wp_deregister_script( 'word-count' );

(Not a mark for/against the idea, just an FYI.)

09/06/07 19:04:19 changed by matt

+1 in new implementation.

09/06/07 21:12:32 changed by Otto42

+1. I see no issues with it being on the write page. Okay, so it's bling, but users notice bling. And given that this is extremely minor bling, I'm for it.

09/07/07 00:40:46 changed by johnbillion

-1. Surely plugin territory. I don't see how this is of any interest to 99% of users.

09/07/07 00:58:07 changed by johnbillion

Although I -1'd it, I've been testing anyway and there are a couple of bugs with 4807b:

  • Write two or more words, word count is immediately out by one.
  • Write any amount of text, delete some and continue writing, word count is now very wrong.

Trunk at r6054, Firefox 2.0 on Vista, applies to RTE and non-RTE. Affects WP.com too.

09/07/07 23:08:47 changed by markjaquith

-1 for core. The vast majority of people don't care. Blogs are supposed to liberate writers from the draconian word-count restrictions of their print ancestors.

Plugin.

09/11/07 12:26:59 changed by filosofo

-1. It seems like a great idea for a plugin. Most users don't care, and those who do probably won't be satisfied anyways unless the count appears publicly.

10/28/07 19:30:05 changed by PaulGregory

Can I solve the plugin/core dilemma with the "on the fence" solution?

Surely everyone would be happy with: +1 for Plugin Distributed With Core, like Dolly. Not active by default.

Obviously, only if the plugin is actually adding things up correctly...

12/26/07 03:12:06 changed by davidszp

+1. I currently use a plugin for this but would love to have it built in. It helps me get a feel for when to stop writing (as I can be wordy). Right now will work for this comment... :-)

01/13/08 04:44:03 changed by hansengel

+1. I'm sure many people would appreciate a word-counter for many different reasons... if they are posting essays that must be a certain length, et cetera.

01/29/08 23:55:52 changed by sillybean

I have a word count script that might be of use. It counts correctly, but I'm still learning JS and I don't know yet how to work around IE's broken event handling. Works great in other browsers.

01/30/08 03:07:54 changed by johnbillion

  • keywords changed from has-patch 2nd-opinion to needs-patch 2nd-opinion.

Changing to needs-patch. With the current patch, the live update count becomes incorrect once any text has been deleted.

03/12/08 10:26:27 changed by pishmishy

  • milestone changed from 2.5 to 2.6.

-1. There's enough debate to conclude that the feature is in plugin territory. I can see how it may be useful to some authors but I don't see it as something that most blog authors would find useful. I'm going to recommend closing, in any case it should be bumped to 2.6

03/12/08 11:44:53 changed by markjaquith

  • status changed from assigned to closed.
  • resolution set to wontfix.
  • milestone deleted.

03/30/08 05:13:17 changed by michaelpark

  • priority changed from low to normal.
  • status changed from closed to reopened.
  • version changed from 2.3 to 2.5.
  • resolution deleted.
  • milestone set to 2.5.1.

I'm in need of this for 2.5. Could anyone update this patch?

(follow-up: ↓ 25 ) 03/30/08 05:20:35 changed by ffemtcj

  • status changed from reopened to closed.
  • resolution set to wontfix.
  • milestone deleted.

This was closed as wontfix. If you need this, you could make a plugin for it.

03/30/08 05:37:56 changed by Viper007Bond

  • priority changed from normal to low.
  • version changed from 2.5 to 2.3.

(in reply to: ↑ 23 ) 03/30/08 18:48:57 changed by michaelpark

Replying to ffemtcj:

This was closed as wontfix. If you need this, you could make a plugin for it.

I would if I could. :(

04/01/08 16:33:15 changed by DavidSzp

There is a plugin that does word counting already (but not live, just on save) called Word Statistics, and it also shows some readability numbers as well. I use it on 2.5 and it seems to work fine.

(follow-up: ↓ 28 ) 04/17/08 19:44:01 changed by azaozz

  • status changed from closed to reopened.
  • severity changed from trivial to minor.
  • priority changed from low to normal.
  • milestone set to 2.5.1.
  • keywords changed from needs-patch 2nd-opinion to has-patch.
  • resolution deleted.

Adapted the script from 4807b for WordPress 2.5/TinyMCE 3, also changed the counting regexp to make it faster and added re-counting on pressing Backspace.

04/17/08 19:44:27 changed by azaozz

  • attachment word-count.patch added.

(in reply to: ↑ 27 ; follow-up: ↓ 29 ) 04/17/08 20:35:45 changed by michaelpark

THANK YOU!

(in reply to: ↑ 28 ) 04/17/08 21:20:44 changed by azaozz

Replying to michaelpark:

THANK YOU!

You're welcome, but it was Matt's idea.

(follow-up: ↓ 31 ) 04/19/08 22:30:14 changed by michaelpark

Count reduction by pressing Backspace key doesn't seem to work, and it's counting punctuations as words if they are followed by a space.

(in reply to: ↑ 30 ) 04/19/08 23:05:18 changed by azaozz

Replying to michaelpark:

Count reduction by pressing Backspace key doesn't seem to work, and it's counting punctuations as words if they are followed by a space.

It re-counts on pressing a key after pressing backspace, so if you delete something by holding down backspace, it will re-count when you start typing again. Same as when typing: it increases the count after pressing the space bar, not when it's pressed.

Yes, special characters/punctuation is counted as a word if it's separate from the end of the previous word. So "Hello!" would be 1 word, but "Hello !" would be 2 words. As far as I can tell all word counting works this way (is separate punctuation considered words? Perhaps non-verbal form of expression? Is this a word " :-) "?).

04/21/08 20:41:44 changed by michaelpark

No, it's not a word. Words should be consist of only alphabets -- no numbers or punctuations.

04/22/08 01:51:07 changed by azaozz

  • attachment word-count2.patch added.

04/22/08 02:01:03 changed by azaozz

OK, fixed. Now it only counts words consisting of letters or mixed letters/numbers, no numbers only or any punctuation/special characters. Still supports all extended ASCII characters, like è, é, ë, ñ, ü, etc.

(follow-up: ↓ 35 ) 04/22/08 02:24:16 changed by michaelpark

Hmmm, I think it's still counting punctuations as words.

(in reply to: ↑ 34 ) 04/22/08 03:01:04 changed by azaozz

Replying to michaelpark:

Hmmm, I think it's still counting punctuations as words.

Now it strips all characters except the letters and spaces before counting. While typing, it still increases the count on every pressing of the spacebar (as it did before), so the count would go higher if typing numbers for example, but then it's corrected when pressing Enter or after pressing Backspace.

It's not practical to re-count on every pressing of the spacebar as in large posts with a lot of HTML tags on slower computers it would interfere with the speed of typing.

The alternative would be to disable the increase of the count on pressing the spacebar and to update it only on Enter and after Backspace (at the end of each paragraph).

Also tried to make it remember the position of the last full re-count (user pressed Enter), then count only the extra words after that on each pressing of the spacebar (the current paragraph). That would make it more accurate while typing, but if the user goes back and deletes some text, then continues typing without triggering full re-count, it still would be wrong. Can put this back in.

04/22/08 03:16:15 changed by michaelpark

That's a good idea actually. I can live with having to press enter.

Thanks again!

04/23/08 01:57:53 changed by matt

  • keywords changed from has-patch to has-patch blessed.
  • milestone changed from 2.5.1 to 2.6.

04/24/08 00:07:19 changed by azaozz

  • attachment word-count3.patch added.

04/24/08 00:11:54 changed by azaozz

Simplified it a bit: now counts only on Enter, or after Backspace or Delete keys are pressed. The word count is updated less frequently but is always right.

04/24/08 01:51:02 changed by azaozz

  • attachment word-count3.2.patch added.

04/25/08 22:53:48 changed by michaelpark

2.5.1 doesn't have this, right?

Feature Request: An option to specify the number of seconds for re-count regardless of when Enter, Backspace and Delete keys are pressed. Or, re-count on automatic save.

04/29/08 19:17:23 changed by ryan

(In [7854]) Word count from azaozz. see #4807