Cursor Navigation cursorForward moves the cursor forward
(steps int)
| 589 | |
| 590 | // cursorForward moves the cursor forward |
| 591 | func (tf *TextField) cursorForward(steps int) { |
| 592 | tf.cursorPos += steps |
| 593 | if tf.cursorPos > len(tf.editText) { |
| 594 | tf.cursorPos = len(tf.editText) |
| 595 | } |
| 596 | if tf.cursorPos > tf.endPos { |
| 597 | inc := tf.cursorPos - tf.endPos |
| 598 | tf.endPos += inc |
| 599 | } |
| 600 | tf.cursorLine, _, _ = tf.renderAll.RuneSpanPos(tf.cursorPos) |
| 601 | if tf.selectMode { |
| 602 | tf.selectRegionUpdate(tf.cursorPos) |
| 603 | } |
| 604 | tf.NeedsRender() |
| 605 | } |
| 606 | |
| 607 | // cursorForwardWord moves the cursor forward by words |
| 608 | func (tf *TextField) cursorForwardWord(steps int) { |
no test coverage detected