Bug 68347 - Incorrect word count in a document with recorded changes
Summary: Incorrect word count in a document with recorded changes
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.0.0.3 release
Hardware: All All
: high normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:4.4.0 target:4.3.3 target:6.2.0
Keywords: bibisected, bisected, regression
: 81668 82332 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-20 17:38 UTC by haim kilov
Modified: 2018-10-22 13:37 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Total word count should be 8 rather than 6; word count in selection should be 2 rather than 0. (46.45 KB, image/jpeg)
2013-08-20 17:38 UTC, haim kilov
Details
screenshot of the same bug in LO 4.1.1.2, OS 10.6.8 (16.57 KB, image/jpeg)
2013-09-18 22:38 UTC, haim kilov
Details
Incorrect word count with "changes" on (10.24 KB, application/vnd.oasis.opendocument.text)
2014-04-17 01:24 UTC, haim kilov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description haim kilov 2013-08-20 17:38:47 UTC
Created attachment 84352 [details]
Total word count should be 8 rather than 6; word count in selection should be 2 rather than 0.

The attachment is a screenshot of a document containing eight words two of which are "new" (shown using recorded changes). However, the LO word count shows only six words. Moreover, the selection contains these two "new" words, but LO shows that there are no words in that selection.
Comment 1 Thomas van der Meulen [retired] 2013-08-22 11:13:51 UTC
Thank you for your bug report, I CAN'T reproduce this bug running Version: 4.1.1.2
Build ID: 7e4286b58adc75a14f6d83f53a03b6c11fa2903 

and Version 4.0.5.2 (Build ID: 5464147a081647a250913f19c0715bca595af2f)
on Mac osx 10.8.4.
Comment 2 haim kilov 2013-09-18 22:38:12 UTC
Created attachment 86113 [details]
screenshot of the same bug in LO 4.1.1.2, OS 10.6.8

Screenshot of the same bug in LO 4.1.1.2, build 7e4286b58adc75a14f6d83f53a03b6c11fa2903

OS 10.6.8
Comment 3 haim kilov 2013-09-18 22:39:22 UTC
Regretfully, the bug is still there!
Comment 4 ign_christian 2013-09-19 03:33:50 UTC
Hi Haim Kilov, please take a look at Bug 46757 & Bug 53399. Might be regression from the bug(s)?
Comment 5 haim kilov 2013-09-19 23:22:23 UTC
(In reply to comment #4)
> Hi Haim Kilov, please take a look at Bug 46757 & Bug 53399. Might be
> regression from the bug(s)?

I looked at 46757 and did the following.

Step 1. Created a new Writer file with 
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eu ligula et arcu dapibus viverra ac ut elit. Proin rhoncus sapien et velit cursus ac molestie justo malesuada. Aliquam pretium, orci nec malesuada laoreet, nisl nisi tristique dui, vitae rutrum ipsum libero sit amet nunc.

Step 2. Record changes.

Step 3. Replaced everything from "Proin" until "nunc." with "this is a test".

Result: Words 18, characters 113.
Should have been: Words 22, characters 128.

Hope this helps.
Comment 6 retired 2013-11-22 19:05:25 UTC
Can you please provide a test document so this can be tested against and subsequently be confirmed.

Does this bug persist with LO 4.1.3.2?

Setting to NEEDINFO until more detail is provided.

After providing the requested info, please reset this bug to UNCONFIRMED. Thanks :)
Comment 7 haim kilov 2014-04-17 01:24:00 UTC
Created attachment 97487 [details]
Incorrect word count with "changes" on

The bug is still there with LO 4.2.3.3.

Please see attached.

The number of words should be 12 (by the way, OpenOffice counts these words correctly).
Comment 8 Jean-Baptiste Faure 2014-06-13 19:06:55 UTC
Reproducible with LO 4.0.6, LO 4.1.6, LO 4.2.6.0+ and LO 4.3.0.0beta2+ under Ubuntu 14.04 x86-64.

Best regards. JBF
Comment 9 sophie 2014-07-23 12:22:18 UTC
*** Bug 81668 has been marked as a duplicate of this bug. ***
Comment 10 Marc Fromentin 2014-08-12 13:54:34 UTC
The bug is still there with LO 4.3.0.4 (Ubuntu 12.04 x86-64 & ppa libreoffice 4.3)

Two precisions on this bug :

- The bug appears only when changes are recorded AND displayed. When the changes are not displayed (but only recorded) there is no problem. 

- When the bug appears, the statistical informations of the document (number of caracters, number of words) are false because LO takes into account deletions but not of the additions. In consequence the length of the text is undervalued.

Hope this helps.
Comment 11 Marc Fromentin 2014-09-02 08:21:56 UTC
*** Bug 82332 has been marked as a duplicate of this bug. ***
Comment 12 Marc Fromentin 2014-09-03 09:29:09 UTC
Reproducible with LO 4.3.1.2 under Win 5.1, Win 7.1, Win 8.1, Ubuntu 12.04 x86-64 (ppa libreoffice)
Comment 13 ign_christian 2014-09-06 10:52:47 UTC
Confirming Marc observation in comment 10.

Tested with attached file in comment 7, problem not occured if we disable 'Show' in tab Edit > Changes

Then if we enable 'Show' again, word count will be back again to the previous state when file opened. Anyway changes still recorded while 'Show' disabled.

Problem not reproduced with LO 3.6.7.2 under Ubuntu 12.04 x86 -> regression
Comment 14 Xisco Faulí 2014-09-09 16:05:13 UTC
Hello Caolan,
With you permission, I add you as a CC because i've seen that you reviewed 6c14d15dbbdc8920e1695b5fdc32b6519508815d which looks to be a regression candidate regarding to bibisect: 47e4a33a6405eb1b5186027f55bd9cb99b0c1fe7..6aeeca56daa9065f607cc7056e7d86d237c84a99

I see that if I don't remove HIDEREDLINED the counts are done correctly:

diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 260c697..56c5db4 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1989,7 +1989,7 @@ bool SwTxtNode::CountWords( SwDocStat& rStat,
     }
 
     // ConversionMap to expand fields, remove invisible and redline deleted text for scanner
-    const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE | HIDEREDLINED);
+    const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE);
     OUString aExpandText = aConversionMap.getViewText();
 
     if (aExpandText.isEmpty() && !bCountNumbering)
--

However, I don't really understand the code, don't know wether this change will introduce other regressions.
Could you please take a look whenever you have some time ? Thanks
Comment 15 Xisco Faulí 2014-10-20 09:14:11 UTC
It seems that the commit that caused this regression was identified. (Or at
least a commit is suspected as the offending one.)

Thus setting keyword "bisected".
Comment 16 Commit Notification 2014-11-03 14:50:02 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fa430e6b4e6f5d096bdf59db26e5d7393ca2297b

Resolves: fdo#68347 fix word count with recorded changes

It will be available in 4.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 17 Commit Notification 2014-11-04 16:59:59 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5ae6072774ab544fdfdfebf2364e97ca2fa2326a&h=libreoffice-4-3

Resolves: fdo#68347 fix word count with recorded changes

It will be available in 4.3.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 18 Marc Fromentin 2014-11-07 10:58:11 UTC
Verified FIXES for versions...

4.3.4.0.0+
Build ID: fae7fed54206b98cc3aac24abcdac384d3bd9437
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:libreoffice-4-3, Time: 2014-11-06_02:16:12

... and...

4.4.0.0.alpha2+
Build ID: bd15fb03dfc3a14b8f1f233080ec3084e0bf25be
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2014-11-07_07:29:27

... on Ubuntu 12.04/64 

It works !

Thank you :)

Best Regards

Marc
Comment 19 Robinson Tryon (qubit) 2015-12-17 10:52:13 UTC
Migrating Whiteboard tags to Keywords: (Bibisected)
[NinjaEdit]
Comment 20 Commit Notification 2018-06-13 14:24:38 UTC
Zdeněk Crhonek committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5db29ca06b56bb235b0e8dfd0956715730f9cf0d

uitest-Word Count;tdf#68347 tdf#91100 tdf#58050 tdf#56975 tdf#56975

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 BogdanB 2018-10-22 13:37:14 UTC
Verified. Ok.

Tested on:
Version: 6.2.0.0.alpha0+
Build ID: 3846561f79cf9065abd9ca83c9fbfbe7e52e28e2
CPU threads: 4; OS: Linux 4.15; UI render: GL; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2018-10-21_02:45:54
Locale: en-US (ro_RO.UTF-8); Calc: threaded