WordLeft moves the cursor one word to the left
()
| 441 | |
| 442 | // WordLeft moves the cursor one word to the left |
| 443 | func (c *Cursor) WordLeft() { |
| 444 | if c.X == 0 { |
| 445 | c.Left() |
| 446 | return |
| 447 | } |
| 448 | c.Left() |
| 449 | for util.IsWhitespace(c.RuneUnder(c.X)) { |
| 450 | if c.X == 0 { |
| 451 | return |
| 452 | } |
| 453 | c.Left() |
| 454 | } |
| 455 | if util.IsNonWordChar(c.RuneUnder(c.X)) && !util.IsWhitespace(c.RuneUnder(c.X)) && |
| 456 | util.IsNonWordChar(c.RuneUnder(c.X-1)) { |
| 457 | for util.IsNonWordChar(c.RuneUnder(c.X)) && !util.IsWhitespace(c.RuneUnder(c.X)) { |
| 458 | if c.X == 0 { |
| 459 | return |
| 460 | } |
| 461 | c.Left() |
| 462 | } |
| 463 | c.Right() |
| 464 | return |
| 465 | } |
| 466 | c.Left() |
| 467 | for util.IsWordChar(c.RuneUnder(c.X)) { |
| 468 | if c.X == 0 { |
| 469 | return |
| 470 | } |
| 471 | c.Left() |
| 472 | } |
| 473 | c.Right() |
| 474 | } |
| 475 | |
| 476 | // SubWordRight moves the cursor one sub-word to the right |
| 477 | func (c *Cursor) SubWordRight() { |
nothing calls this directly
no test coverage detected