MCPcopy Create free account
hub / github.com/cogentcore/core / lastVisibleLine

Method lastVisibleLine

texteditor/render.go:534–546  ·  view source on GitHub ↗

lastVisibleLine finds the last visible line, starting at given line (typically cursor) -- returns stln if nothing found beyond it.

(stln int)

Source from the content-addressed store, hash-verified

532// lastVisibleLine finds the last visible line, starting at given line
533// (typically cursor) -- returns stln if nothing found beyond it.
534func (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

Callers 1

cursorPageDownMethod · 0.95

Calls 3

renderBBoxMethod · 0.95
charStartPosMethod · 0.95
FloorFunction · 0.92

Tested by

no test coverage detected