WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#27391 closed defect (bug) (fixed)

Editor: Word count should exclude ellipsis

Reported by: bassgang Owned by: iseulde
Milestone: 4.3 Priority: normal
Severity: minor Version: 2.3
Component: Editor Keywords: has-patch
Focuses: javascript Cc:

Description

The "Word count" shown below the post editor counts a ellipsis "…" as a word at the moment. As a ellipsis is more punctation than a word, it should be excluded from the "Word count".

Steps to reproduce:

  • Add a new post
  • Add a ellipsis (Mac: Alt + .) "…"
  • See "Word count"


I think this is a good first bug since the fix should be relatively easy. Extend the "clean" regular expression with ellipsis match in https://core.trac.wordpress.org/browser/trunk/src/wp-admin/js/word-count.js#L8.

Attachments (2)

editor_word_count_ellipsis.png (39.8 KB) - added by bassgang 7 years ago.
wordcount-fix.27391.diff (552 bytes) - added by lukechilds 7 years ago.
Added ellipsis unicode character to 'clean' regex.

Download all attachments as: .zip

Change History (7)

#1 @desaiuditd
7 years ago

  • Keywords dev-feedback ui-feedback reporter-feedback 2nd-opinion added

In this case; I think ellipsis does fall under Unicode characters category. So here the question is do we have to handle all the Unicodes and put a Regex for that or Unicodes are to be counted as a word.

#2 @johnbillion
7 years ago

  • Keywords dev-feedback ui-feedback reporter-feedback removed
  • Severity changed from normal to minor
  • Version changed from trunk to 2.3

Related: #27386

@lukechilds
7 years ago

Added ellipsis unicode character to 'clean' regex.

#3 @iseulde
6 years ago

  • Keywords has-patch added; 2nd-opinion removed
  • Milestone changed from Awaiting Review to Future Release

See #30966. The patch there would exclude ranges of unicode characters.

#4 @iseulde
6 years ago

  • Owner set to iseulde
  • Resolution set to fixed
  • Status changed from new to closed

In 33292:

Editor: word count: exclude more characters

Also only exclude these characters for the words type. They should be counted for other types.
Add the ASCIIOnly option to the uglify config to preserve escaped unicode characters.

See #30966. Fixes #27391.

#5 @iseulde
6 years ago

  • Milestone changed from Future Release to 4.3
Note: See TracTickets for help on using tickets.