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

Method Center

internal/action/actions.go:163–169  ·  view source on GitHub ↗

Center centers the view on the cursor

()

Source from the content-addressed store, hash-verified

161
162// Center centers the view on the cursor
163func (h *BufPane) Center() bool {
164 v := h.GetView()
165 v.StartLine = h.Scroll(h.SLocFromLoc(h.Cursor.Loc), -h.BufView().Height/2)
166 h.SetView(v)
167 h.ScrollAdjust()
168 return true
169}
170
171// CursorToViewTop moves the cursor to the top of the view,
172// offset by scrollmargin unless at the beginning or end of the file

Callers

nothing calls this directly

Calls 6

ScrollAdjustMethod · 0.95
GetViewMethod · 0.65
ScrollMethod · 0.65
SLocFromLocMethod · 0.65
BufViewMethod · 0.65
SetViewMethod · 0.65

Tested by

no test coverage detected