SubWordLeft moves the cursor one sub-word to the left
()
| 535 | |
| 536 | // SubWordLeft moves the cursor one sub-word to the left |
| 537 | func (c *Cursor) SubWordLeft() { |
| 538 | if c.X == 0 { |
| 539 | c.Left() |
| 540 | return |
| 541 | } |
| 542 | c.Left() |
| 543 | if util.IsWhitespace(c.RuneUnder(c.X)) { |
| 544 | for util.IsWhitespace(c.RuneUnder(c.X)) { |
| 545 | if c.X == 0 { |
| 546 | return |
| 547 | } |
| 548 | c.Left() |
| 549 | } |
| 550 | c.Right() |
| 551 | return |
| 552 | } |
| 553 | if util.IsNonWordChar(c.RuneUnder(c.X)) && !util.IsWhitespace(c.RuneUnder(c.X)) { |
| 554 | for util.IsNonWordChar(c.RuneUnder(c.X)) && !util.IsWhitespace(c.RuneUnder(c.X)) { |
| 555 | if c.X == 0 { |
| 556 | return |
| 557 | } |
| 558 | c.Left() |
| 559 | } |
| 560 | c.Right() |
| 561 | return |
| 562 | } |
| 563 | if util.IsSubwordDelimiter(c.RuneUnder(c.X)) { |
| 564 | for util.IsSubwordDelimiter(c.RuneUnder(c.X)) { |
| 565 | if c.X == 0 { |
| 566 | return |
| 567 | } |
| 568 | c.Left() |
| 569 | } |
| 570 | if util.IsWhitespace(c.RuneUnder(c.X)) { |
| 571 | c.Right() |
| 572 | return |
| 573 | } |
| 574 | } |
| 575 | if c.X == 0 { |
| 576 | return |
| 577 | } |
| 578 | if util.IsUpperLetter(c.RuneUnder(c.X)) && |
| 579 | util.IsUpperLetter(c.RuneUnder(c.X-1)) { |
| 580 | for util.IsUpperAlphanumeric(c.RuneUnder(c.X)) { |
| 581 | if c.X == 0 { |
| 582 | return |
| 583 | } |
| 584 | c.Left() |
| 585 | } |
| 586 | if !util.IsUpperAlphanumeric(c.RuneUnder(c.X)) { |
| 587 | c.Right() |
| 588 | } |
| 589 | } else { |
| 590 | for util.IsLowerAlphanumeric(c.RuneUnder(c.X)) { |
| 591 | if c.X == 0 { |
| 592 | return |
| 593 | } |
| 594 | c.Left() |
nothing calls this directly
no test coverage detected