MCPcopy
hub / github.com/micro-editor/micro / SubWordRight

Method SubWordRight

internal/buffer/cursor.go:477–534  ·  view source on GitHub ↗

SubWordRight moves the cursor one sub-word to the right

()

Source from the content-addressed store, hash-verified

475
476// SubWordRight moves the cursor one sub-word to the right
477func (c *Cursor) SubWordRight() {
478 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
479 c.Right()
480 return
481 }
482 if util.IsWhitespace(c.RuneUnder(c.X)) {
483 for util.IsWhitespace(c.RuneUnder(c.X)) {
484 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
485 return
486 }
487 c.Right()
488 }
489 return
490 }
491 if util.IsNonWordChar(c.RuneUnder(c.X)) && !util.IsWhitespace(c.RuneUnder(c.X)) {
492 for util.IsNonWordChar(c.RuneUnder(c.X)) && !util.IsWhitespace(c.RuneUnder(c.X)) {
493 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
494 return
495 }
496 c.Right()
497 }
498 return
499 }
500 if util.IsSubwordDelimiter(c.RuneUnder(c.X)) {
501 for util.IsSubwordDelimiter(c.RuneUnder(c.X)) {
502 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
503 return
504 }
505 c.Right()
506 }
507 if util.IsWhitespace(c.RuneUnder(c.X)) {
508 return
509 }
510 }
511 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
512 return
513 }
514 if util.IsUpperLetter(c.RuneUnder(c.X)) &&
515 util.IsUpperLetter(c.RuneUnder(c.X+1)) {
516 for util.IsUpperAlphanumeric(c.RuneUnder(c.X)) {
517 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
518 return
519 }
520 c.Right()
521 }
522 if util.IsLowerAlphanumeric(c.RuneUnder(c.X)) {
523 c.Left()
524 }
525 } else {
526 c.Right()
527 for util.IsLowerAlphanumeric(c.RuneUnder(c.X)) {
528 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
529 return
530 }
531 c.Right()
532 }
533 }
534}

Callers

nothing calls this directly

Calls 11

RightMethod · 0.95
RuneUnderMethod · 0.95
LeftMethod · 0.95
CharacterCountFunction · 0.92
IsWhitespaceFunction · 0.92
IsNonWordCharFunction · 0.92
IsSubwordDelimiterFunction · 0.92
IsUpperLetterFunction · 0.92
IsUpperAlphanumericFunction · 0.92
IsLowerAlphanumericFunction · 0.92
LineBytesMethod · 0.65

Tested by

no test coverage detected