()
| 656 | // 2. A sequence of non-blank, non-word characters (punctuation/symbols) |
| 657 | |
| 658 | nextVimWord(): Cursor { |
| 659 | if (this.isAtEnd()) { |
| 660 | return this |
| 661 | } |
| 662 | |
| 663 | let pos = this.offset |
| 664 | const advance = (p: number): number => this.measuredText.nextOffset(p) |
| 665 | |
| 666 | const currentGrapheme = this.graphemeAt(pos) |
| 667 | if (!currentGrapheme) { |
| 668 | return this |
| 669 | } |
| 670 | |
| 671 | if (isVimWordChar(currentGrapheme)) { |
| 672 | while (pos < this.text.length && isVimWordChar(this.graphemeAt(pos))) { |
| 673 | pos = advance(pos) |
| 674 | } |
| 675 | } else if (isVimPunctuation(currentGrapheme)) { |
| 676 | while (pos < this.text.length && isVimPunctuation(this.graphemeAt(pos))) { |
| 677 | pos = advance(pos) |
| 678 | } |
| 679 | } |
| 680 | |
| 681 | while ( |
| 682 | pos < this.text.length && |
| 683 | WHITESPACE_REGEX.test(this.graphemeAt(pos)) |
| 684 | ) { |
| 685 | pos = advance(pos) |
| 686 | } |
| 687 | |
| 688 | return new Cursor(this.measuredText, pos) |
| 689 | } |
| 690 | |
| 691 | endOfVimWord(): Cursor { |
| 692 | if (this.isAtEnd()) { |
no test coverage detected