wordRight moves the cursor one word to the right. Returns whether or not the cursor blink should be reset. If the input is masked, move input to the end so as not to reveal word breaks in the masked input.
()
| 517 | // cursor blink should be reset. If the input is masked, move input to the end |
| 518 | // so as not to reveal word breaks in the masked input. |
| 519 | func (m *TextInputModel) wordRight() bool { |
| 520 | if m.pos >= len(m.value) || len(m.value) == 0 { |
| 521 | return false |
| 522 | } |
| 523 | |
| 524 | if m.EchoMode != EchoNormal { |
| 525 | return m.cursorEnd() |
| 526 | } |
| 527 | |
| 528 | blink := false |
| 529 | i := m.pos |
| 530 | for i < len(m.value) { |
| 531 | if unicode.IsSpace(m.value[i]) { |
| 532 | blink = m.setCursor(m.pos + 1) |
| 533 | i++ |
| 534 | } else { |
| 535 | break |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | for i < len(m.value) { |
| 540 | if !unicode.IsSpace(m.value[i]) { |
| 541 | blink = m.setCursor(m.pos + 1) |
| 542 | i++ |
| 543 | } else { |
| 544 | break |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | return blink |
| 549 | } |
| 550 | |
| 551 | func (m TextInputModel) echoTransform(v string) string { |
| 552 | switch m.EchoMode { |