MCPcopy
hub / github.com/micro-editor/micro / CursorToViewBottom

Method CursorToViewBottom

internal/action/actions.go:201–215  ·  view source on GitHub ↗

CursorToViewBottom moves the cursor to the bottom of the view, offset by scrollmargin unless at the beginning or end of the file

()

Source from the content-addressed store, hash-verified

199// CursorToViewBottom moves the cursor to the bottom of the view,
200// offset by scrollmargin unless at the beginning or end of the file
201func (h *BufPane) CursorToViewBottom() bool {
202 v := h.GetView()
203 h.Buf.ClearCursors()
204 scrollmargin := int(h.Buf.Settings["scrollmargin"].(float64))
205 bEnd := h.SLocFromLoc(h.Buf.End())
206 lastLine := h.Scroll(v.StartLine, h.BufView().Height-1)
207 if lastLine == bEnd {
208 scrollmargin = 0
209 }
210 h.Cursor.GotoLoc(h.LocFromVLoc(display.VLoc{
211 SLoc: h.Scroll(lastLine, -scrollmargin),
212 VisualX: 0,
213 }))
214 return true
215}
216
217// MoveCursorUp is not an action
218func (h *BufPane) MoveCursorUp(n int) {

Callers

nothing calls this directly

Calls 8

ClearCursorsMethod · 0.80
GetViewMethod · 0.65
SLocFromLocMethod · 0.65
ScrollMethod · 0.65
BufViewMethod · 0.65
LocFromVLocMethod · 0.65
EndMethod · 0.45
GotoLocMethod · 0.45

Tested by

no test coverage detected