| 602 | } |
| 603 | |
| 604 | func (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 | |
| 627 | func (buffer *Buffer) GetVisibleLines() []Line { |
| 628 | lines := []Line{} |