MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / endOfWORD

Method endOfWORD

src/utils/Cursor.ts:763–794  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

761 }
762
763 endOfWORD(): Cursor {
764 if (this.isAtEnd()) {
765 return this
766 }
767
768 // eslint-disable-next-line @typescript-eslint/no-this-alias
769 let cursor: Cursor = this
770
771 // Check if we're already at the end of a WORD
772 // (current character is non-whitespace, but next character is whitespace or we're at the end)
773 const atEndOfWORD =
774 !cursor.isOverWhitespace() &&
775 (cursor.right().isOverWhitespace() || cursor.right().isAtEnd())
776
777 if (atEndOfWORD) {
778 // We're already at the end of a WORD, move to the next WORD
779 cursor = cursor.right()
780 return cursor.endOfWORD()
781 }
782
783 // If we're on a whitespace character, find the next WORD
784 if (cursor.isOverWhitespace()) {
785 cursor = cursor.nextWORD()
786 }
787
788 // Now move to the end of the current WORD
789 while (!cursor.right().isOverWhitespace() && !cursor.isAtEnd()) {
790 cursor = cursor.right()
791 }
792
793 return cursor
794 }
795
796 prevWORD(): Cursor {
797 // eslint-disable-next-line @typescript-eslint/no-this-alias

Callers 2

getOperatorRangeFunction · 0.80
applySingleMotionFunction · 0.80

Calls 4

isAtEndMethod · 0.95
isOverWhitespaceMethod · 0.80
rightMethod · 0.80
nextWORDMethod · 0.80

Tested by

no test coverage detected