bugGNU nano - Bugs: bug #61367, the M-D word count is inconsistent...


You are not allowed to post comments on this tracker with your current authentication level.

bug #61367: the M-D word count is inconsistent with how Ctrl+Left/Right move

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Fri 22 Oct 2021 01:29:37 PM UTC  
Severity:  2 - Minor Status:  Fixed
Assigned to:  Benno Schulenberg <bens> Open/Closed:  Open

Wed 27 Oct 2021 02:37:44 PM UTC, comment #1: 

Fixed in git, commit 33041d0a, by passing the WORD_BOUNDS flag to do_next_word(), like everywhere else.

(The subsequent commit elides the second parameter of do_next_word(), as it has now become redundant.)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Fri 22 Oct 2021 01:29:37 PM UTC, original submission:  

To see what I mean, run:

echo "   one ;;; two" >words
echo "blue-bearded clear-headed swede" >>words
src/nano --ignore words

Then type: M-D

See that it says: 6 words.  From a human viewpoint this can't be right -- there are either five words or seven words, depending on whether you consider hyphenated things as a single word.

Now type Ctrl+Right seven times.  See that according to the word-jumping function there are seven words.

Now exit and run 'src/nano --ignore words -W'.  Type M-D and see there are still six words.  Then type Ctrl+Right six times.  See that the word-jumping sees six words.  It considers ";;;" to be a word, which very few people would do, but at least now the count and the jumping are consistent.

Now run 'vim words' and type: g ^G.  It says there are six words.  Use Ctrl+Right.  It jumps over six words, behaving like 'nano -W'.  Okay, consistent.  Exit with: :q!

Now run 'emacs words' and type: M-- M-=.  It says there are seven words.  Use Ctrl+Right.  It jumps to the ends of seven words.  Good, consistent.  Exit with: ^G ^X ^C

Expected behavior: the -W (--wordbounds) option should affect the M-D word count, so that it is consistent with the word-jumping cursor movement.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bens (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-10-27 bens StatusNone => Fixed
    2021-10-24 bens Assigned toNone => bens

    Back to the top

    Powered by Savane 3.7