MCPcopy
hub / github.com/liamg/darktile / setPosition

Method setPosition

internal/app/darktile/termutil/buffer.go:604–625  ·  view source on GitHub ↗
(col uint16, line uint16)

Source from the content-addressed store, hash-verified

602}
603
604func (buffer *Buffer) setPosition(col uint16, line uint16) {
605
606 useCol := col
607 useLine := line
608 maxLine := buffer.ViewHeight() - 1
609
610 if buffer.modes.OriginMode {
611 useLine += uint16(buffer.topMargin)
612 maxLine = uint16(buffer.bottomMargin)
613 // @todo left and right margins
614 }
615 if useLine > maxLine {
616 useLine = maxLine
617 }
618
619 if useCol >= buffer.ViewWidth() {
620 useCol = buffer.ViewWidth() - 1
621 }
622
623 buffer.cursorPosition.Col = useCol
624 buffer.cursorPosition.Line = buffer.convertViewLineToRawLine(useLine)
625}
626
627func (buffer *Buffer) GetVisibleLines() []Line {
628 lines := []Line{}

Callers 10

movePositionMethod · 0.95
clearMethod · 0.95
TestSetPositionFunction · 0.80
handleScreenStateMethod · 0.80
csiSetMarginsHandlerMethod · 0.80

Calls 3

ViewHeightMethod · 0.95
ViewWidthMethod · 0.95

Tested by 1

TestSetPositionFunction · 0.64