* Scroll viewport to a specific line in the buffer * @param line Line number (0 = top of scrollback, scrollbackLength = bottom)
(line: number)
| 920 | * @param line Line number (0 = top of scrollback, scrollbackLength = bottom) |
| 921 | */ |
| 922 | public scrollToLine(line: number): void { |
| 923 | const scrollbackLength = this.getScrollbackLength(); |
| 924 | const newViewportY = Math.max(0, Math.min(scrollbackLength, line)); |
| 925 | |
| 926 | if (newViewportY !== this.viewportY) { |
| 927 | this.viewportY = newViewportY; |
| 928 | this.scrollEmitter.fire(this.viewportY); |
| 929 | |
| 930 | // Show scrollbar when scrolling to specific line |
| 931 | if (scrollbackLength > 0) { |
| 932 | this.showScrollbar(); |
| 933 | } |
| 934 | } |
| 935 | } |
| 936 | |
| 937 | /** |
| 938 | * Smoothly scroll to a target viewport position |
no test coverage detected