MCPcopy Create free account
hub / github.com/coder/ghostty-web / scrollToLine

Method scrollToLine

lib/terminal.ts:922–935  ·  view source on GitHub ↗

* Scroll viewport to a specific line in the buffer * @param line Line number (0 = top of scrollback, scrollbackLength = bottom)

(line: number)

Source from the content-addressed store, hash-verified

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

Callers 3

TerminalClass · 0.95
processScrollbarDragMethod · 0.95
scrolling.test.tsFile · 0.80

Calls 3

getScrollbackLengthMethod · 0.95
showScrollbarMethod · 0.95
fireMethod · 0.45

Tested by

no test coverage detected