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

Method CursorToViewCenter

internal/action/actions.go:189–197  ·  view source on GitHub ↗

CursorToViewCenter moves the cursor to the center of the view

()

Source from the content-addressed store, hash-verified

187
188// CursorToViewCenter moves the cursor to the center of the view
189func (h *BufPane) CursorToViewCenter() bool {
190 v := h.GetView()
191 h.Buf.ClearCursors()
192 h.Cursor.GotoLoc(h.LocFromVLoc(display.VLoc{
193 SLoc: h.Scroll(v.StartLine, h.BufView().Height/2),
194 VisualX: 0,
195 }))
196 return true
197}
198
199// CursorToViewBottom moves the cursor to the bottom of the view,
200// offset by scrollmargin unless at the beginning or end of the file

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected