commit 33041d0ad5b06c22c2705723dfba4f2a04999fc0
parent b46c8c586bcc1c253ad506ff8262a912f23c86fb
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 24 Oct 2021 09:34:35 +0200
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/text.c b/src/text.c
@@ -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++;
}