sw/source/uibase/uiview/view2.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit ef5aadffaefe47870f1e9472d7cdb8d37526c104
Author:     Jamie Douglass <jdougla...@me.com>
AuthorDate: Mon Jan 1 11:30:39 2024 +1100
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Jan 1 10:15:24 2024 +0100

    tdf#142494 Word count set to 0 when no words are selected.
    
    The application now correctly recognises selections without words.
    When a selection is made that does not contain a word, the word count is
    set to zero, and the text "Selected: 0 words, x chars" now appears
    
    Change-Id: Icfa0a6fe2bf6315485102d6ad9b3cea5b6d8d139
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161509
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index cc6faf78a3c5..2c7a07449715 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1876,11 +1876,11 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
                 rShell.CountWords(selectionStats);
                 documentStats = 
rShell.GetDoc()->getIDocumentStatistics().GetUpdatedDocStat( true /* 
complete-async */, false /* don't update fields */ );
 
-                sal_uLong nWord = selectionStats.nWord ? selectionStats.nWord 
: documentStats.nWord;
+                sal_uLong nWord = selectionStats.nChar ? selectionStats.nWord 
: documentStats.nWord;
                 sal_uLong nChar = selectionStats.nChar ? selectionStats.nChar 
: documentStats.nChar;
-                TranslateId pResId = selectionStats.nWord ? STR_WORDCOUNT : 
STR_WORDCOUNT_NO_SELECTION;
-                TranslateNId pWordResId = selectionStats.nWord ? 
STR_WORDCOUNT_WORDARG : STR_WORDCOUNT_WORDARG_NO_SELECTION;
-                TranslateNId pCharResId = selectionStats.nWord ? 
STR_WORDCOUNT_CHARARG : STR_WORDCOUNT_CHARARG_NO_SELECTION;
+                TranslateId pResId = selectionStats.nChar ? STR_WORDCOUNT : 
STR_WORDCOUNT_NO_SELECTION;
+                TranslateNId pWordResId = selectionStats.nChar ? 
STR_WORDCOUNT_WORDARG : STR_WORDCOUNT_WORDARG_NO_SELECTION;
+                TranslateNId pCharResId = selectionStats.nChar ? 
STR_WORDCOUNT_CHARARG : STR_WORDCOUNT_CHARARG_NO_SELECTION;
 
                 const LocaleDataWrapper& rLocaleData = 
Application::GetSettings().GetUILocaleDataWrapper();
                 OUString aWordArg = SwResId(pWordResId, 
nWord).replaceAll("$1", rLocaleData.getNum(nWord, 0));

Reply via email to