cursorStartLine moves the cursor to the start of the line, updating selection if select mode is active
()
| 483 | // cursorStartLine moves the cursor to the start of the line, updating selection |
| 484 | // if select mode is active |
| 485 | func (ed *Editor) cursorStartLine() { |
| 486 | ed.validateCursor() |
| 487 | org := ed.CursorPos |
| 488 | pos := ed.CursorPos |
| 489 | |
| 490 | gotwrap := false |
| 491 | if wln := ed.wrappedLines(pos.Ln); wln > 1 { |
| 492 | si, ri, _ := ed.wrappedLineNumber(pos) |
| 493 | if si > 0 { |
| 494 | ri = 0 |
| 495 | nwc, _ := ed.renders[pos.Ln].SpanPosToRuneIndex(si, ri) |
| 496 | pos.Ch = nwc |
| 497 | ed.CursorPos = pos |
| 498 | ed.cursorColumn = ri |
| 499 | gotwrap = true |
| 500 | } |
| 501 | } |
| 502 | if !gotwrap { |
| 503 | ed.CursorPos.Ch = 0 |
| 504 | ed.cursorColumn = ed.CursorPos.Ch |
| 505 | } |
| 506 | // fmt.Printf("sol cursorcol: %v\n", ed.CursorCol) |
| 507 | ed.setCursor(ed.CursorPos) |
| 508 | ed.scrollCursorToRight() |
| 509 | ed.renderCursor(true) |
| 510 | ed.cursorSelect(org) |
| 511 | ed.NeedsRender() |
| 512 | } |
| 513 | |
| 514 | // CursorStartDoc moves the cursor to the start of the text, updating selection |
| 515 | // if select mode is active |
no test coverage detected