Opened 8 months ago
Last modified 4 months ago
#26620 new defect (bug)
Word Count is one number short
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | needs-patch needs-refresh |
Focuses: | Cc: |
Description
Write a post. The count will be one number too low in text view if you don't press enter.
For example:
This is some content. It should be ten words long.
The counter shows that being 9 words.
related: #6991
Attachments (4)
Change History (12)
comment:1
SergeyBiryukov
— 8 months ago
- Component changed from General to Editor
comment:2
follow-up:
↓ 4
jorbin
— 8 months ago
- Keywords has-patch added
The above patch includes both a fix and a unit test.
I'm not sure if I am correctly checking for being in txt mode vs being in tinymce mode. Is there a better way to get this information?
comment:3
SergeyBiryukov
— 8 months ago
- Milestone changed from Awaiting Review to 3.9
comment:4
in reply to:
↑ 2
nacin
— 8 months ago
Replying to jorbin:
I'm not sure if I am correctly checking for being in txt mode vs being in tinymce mode. Is there a better way to get this information?
Appears to be this: typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
comment:5
nacin
— 8 months ago
Two possible alternative fixes that are not editor-dependent:
- Add a space to the end of tx prior to running the count.
- Use /\S(\s+|$)/gm instead (untested).
comment:6
nacin
— 8 months ago
Also, 26620.2.diff has JSHint errors. :-)
comment:7
jorbin
— 8 months ago
Padding a space on to the end seemed simpler than changing the regex and works independent of the editor. New patch does that.
JSHint errors fixed.
comment:8
DH-Shredder
— 4 months ago
- Keywords needs-patch needs-refresh added; has-patch removed
- Milestone changed from 3.9 to Future Release
Due RC coming shortly, because this patch's tests don't cleanly apply and the current patch still seems to have the bug above, moving to future release.
Unit Test