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

Method initialRelocate

internal/action/bufpane.go:380–395  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

378}
379
380func (h *BufPane) initialRelocate() {
381 sloc := h.SLocFromLoc(h.Cursor.Loc)
382 height := h.BufView().Height
383
384 // If the initial cursor location is far away from the beginning
385 // of the buffer, ensure the cursor is at 25% of the window height
386 v := h.GetView()
387 if h.Diff(display.SLoc{0, 0}, sloc) < height {
388 v.StartLine = display.SLoc{0, 0}
389 } else {
390 v.StartLine = h.Scroll(sloc, -height/4)
391 h.ScrollAdjust()
392 }
393 v.StartCol = 0
394 h.Relocate()
395}
396
397// ID returns this pane's split id.
398func (h *BufPane) ID() uint64 {

Callers 2

finishInitializeMethod · 0.95
OpenBufferMethod · 0.95

Calls 7

ScrollAdjustMethod · 0.95
SLocFromLocMethod · 0.65
BufViewMethod · 0.65
GetViewMethod · 0.65
DiffMethod · 0.65
ScrollMethod · 0.65
RelocateMethod · 0.65

Tested by

no test coverage detected