statusbar: count words in the way that matches how Ctrl+Right moves

When --wordbounds (-W) is active, nano considers punctuation as
word-forming characters and will thus count words the same way
as 'wc -w' does.  This is how nano counted words until now.

But when --wordbounds is not active (the default), only letters
and digits will be considered word-forming and thus lone groups
of lines and dashes and other punctuation will not be counted
as words, which is more like how a human would count words.

This addresses https://savannah.gnu.org/bugs/?61367.
This commit is contained in:
Benno Schulenberg 2021-10-24 09:34:35 +02:00
parent b46c8c586b
commit 33041d0ad5

View File

@ -2960,7 +2960,7 @@ void count_lines_words_and_characters(void)
* incrementing the word count for each successful step. */
while (openfile->current->lineno < botline->lineno ||
(openfile->current == botline && openfile->current_x < bot_x)) {
if (do_next_word(FALSE, TRUE))
if (do_next_word(FALSE, ISSET(WORD_BOUNDS)))
words++;
}