@@ -1021,6 +1021,27 @@ def test_vi_word_boundaries(self):
10211021 ("get_value(x)" , "$b" , 10 , "b from end lands on x" ),
10221022 ("get_value(x)" , "$bb" , 9 , "second b lands on (" ),
10231023 ("get_value(x)" , "$bbb" , 0 , "third b lands on get_value" ),
1024+
1025+ # W (WORD motion by whitespace-delimited words)
1026+ ("foo.bar baz" , "0W" , 8 , "W skips punctuation to baz" ),
1027+ ("one,two three" , "0W" , 8 , "W skips comma to three" ),
1028+ ("hello world" , "0W" , 8 , "W handles multiple spaces" ),
1029+ ("get_value(x)" , "0W" , 11 , "W clamps to end (no whitespace)" ),
1030+
1031+ # Backward W (B)
1032+ ("foo.bar baz" , "$B" , 8 , "B from end lands on baz" ),
1033+ ("foo.bar baz" , "$BB" , 0 , "second B lands on foo.bar" ),
1034+ ("one,two three" , "$B" , 8 , "B from end lands on three" ),
1035+ ("one,two three" , "$BB" , 0 , "second B lands on one,two" ),
1036+ ("hello world" , "$B" , 8 , "B from end lands on world" ),
1037+ ("hello world" , "$BB" , 0 , "second B lands on hello" ),
1038+
1039+ # Edge cases
1040+ (" spaces" , "0w" , 3 , "w from BOL skips leading spaces" ),
1041+ ("trailing " , "0w" , 10 , "w clamps at end after trailing spaces" ),
1042+ ("a" , "0w" , 0 , "w on single char stays in bounds" ),
1043+ ("" , "0w" , 0 , "w on empty buffer stays at 0" ),
1044+ ("a b c" , "0www" , 4 , "multiple w's work correctly" ),
10241045 ]
10251046
10261047 for text , keys , expected_pos , desc in test_cases :
0 commit comments