cursorForward moves the cursor forward
(steps int)
| 189 | |
| 190 | // cursorForward moves the cursor forward |
| 191 | func (ed *Editor) cursorForward(steps int) { |
| 192 | ed.validateCursor() |
| 193 | org := ed.CursorPos |
| 194 | for i := 0; i < steps; i++ { |
| 195 | ed.CursorPos.Ch++ |
| 196 | if ed.CursorPos.Ch > ed.Buffer.LineLen(ed.CursorPos.Ln) { |
| 197 | if ed.CursorPos.Ln < ed.NumLines-1 { |
| 198 | ed.CursorPos.Ch = 0 |
| 199 | ed.CursorPos.Ln++ |
| 200 | } else { |
| 201 | ed.CursorPos.Ch = ed.Buffer.LineLen(ed.CursorPos.Ln) |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | ed.setCursorColumn(ed.CursorPos) |
| 206 | ed.SetCursorShow(ed.CursorPos) |
| 207 | ed.cursorSelect(org) |
| 208 | ed.NeedsRender() |
| 209 | } |
| 210 | |
| 211 | // cursorForwardWord moves the cursor forward by words |
| 212 | func (ed *Editor) cursorForwardWord(steps int) { |
no test coverage detected