lastVisibleLine finds the last visible line, starting at given line (typically cursor) -- returns stln if nothing found beyond it.
(stln int)
| 532 | // lastVisibleLine finds the last visible line, starting at given line |
| 533 | // (typically cursor) -- returns stln if nothing found beyond it. |
| 534 | func (ed *Editor) lastVisibleLine(stln int) int { |
| 535 | bb := ed.renderBBox() |
| 536 | lastln := stln |
| 537 | for ln := stln + 1; ln < ed.NumLines; ln++ { |
| 538 | pos := lexer.Pos{Ln: ln} |
| 539 | cpos := ed.charStartPos(pos) |
| 540 | if int(math32.Floor(cpos.Y)) > bb.Max.Y { // just offscreen |
| 541 | break |
| 542 | } |
| 543 | lastln = ln |
| 544 | } |
| 545 | return lastln |
| 546 | } |
| 547 | |
| 548 | // PixelToCursor finds the cursor position that corresponds to the given pixel |
| 549 | // location (e.g., from mouse click) which has had ScBBox.Min subtracted from |
no test coverage detected