SubWordRight moves the cursor one sub-word to the right
()
| 475 | |
| 476 | // SubWordRight moves the cursor one sub-word to the right |
| 477 | func (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 | } |
nothing calls this directly
no test coverage detected