cursorUp moves the cursor up
(steps int)
| 746 | |
| 747 | // cursorUp moves the cursor up |
| 748 | func (tf *TextField) cursorUp(steps int) { |
| 749 | if tf.numLines <= 1 { |
| 750 | return |
| 751 | } |
| 752 | if tf.cursorLine <= 0 { |
| 753 | return |
| 754 | } |
| 755 | |
| 756 | _, ri, _ := tf.renderAll.RuneSpanPos(tf.cursorPos) |
| 757 | tf.cursorLine = max(tf.cursorLine-steps, 0) |
| 758 | tf.cursorPos, _ = tf.renderAll.SpanPosToRuneIndex(tf.cursorLine, ri) |
| 759 | if tf.selectMode { |
| 760 | tf.selectRegionUpdate(tf.cursorPos) |
| 761 | } |
| 762 | tf.NeedsRender() |
| 763 | } |
| 764 | |
| 765 | // cursorStart moves the cursor to the start of the text, updating selection |
| 766 | // if select mode is active. |
no test coverage detected