@aurigax-ai/ghostty-web 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/interfaces.ts CHANGED
@@ -41,6 +41,7 @@ export interface ITerminalOptions {
41
41
  scrollOnUserInput?: boolean; // Typing or pasting scrolls to the bottom (default: true)
42
42
 
43
43
  // Scrolling options
44
+ scrollbar?: boolean; // Draw the built-in scrollbar and let it be dragged (default: true)
44
45
  smoothScrollDuration?: number; // Duration in ms for smooth scroll animation (default: 100, 0 = instant)
45
46
 
46
47
  // Internal: Ghostty WASM instance (optional, for test isolation)
package/lib/terminal.ts CHANGED
@@ -210,6 +210,7 @@ export class Terminal implements ITerminalCore {
210
210
  convertEol: options.convertEol ?? false,
211
211
  disableStdin: options.disableStdin ?? false,
212
212
  scrollOnUserInput: options.scrollOnUserInput ?? true,
213
+ scrollbar: options.scrollbar ?? true,
213
214
  smoothScrollDuration: options.smoothScrollDuration ?? 100, // Default: 100ms smooth scroll
214
215
  fontWeight: options.fontWeight ?? 'normal',
215
216
  fontWeightBold: options.fontWeightBold ?? 'bold',
@@ -299,6 +300,10 @@ export class Terminal implements ITerminalCore {
299
300
  this.wasmTerm?.configure({ scrollbackLimit: this.options.scrollback });
300
301
  break;
301
302
 
303
+ case 'scrollbar':
304
+ if (!this.options.scrollbar) this.dropScrollbar();
305
+ break;
306
+
302
307
  case 'fontSize':
303
308
  if (this.renderer) {
304
309
  this.renderer.setFontSize(this.options.fontSize);
@@ -1827,7 +1832,7 @@ export class Terminal implements ITerminalCore {
1827
1832
  if (!this.canvas || !this.renderer || !this.wasmTerm) return;
1828
1833
 
1829
1834
  const scrollbackLength = this.wasmTerm.getScrollbackLength();
1830
- if (scrollbackLength === 0) return; // No scrollbar if no scrollback
1835
+ if (scrollbackLength === 0 || !this.options.scrollbar) return;
1831
1836
 
1832
1837
  const rect = this.canvas.getBoundingClientRect();
1833
1838
  const mouseX = e.clientX - rect.left;
@@ -1938,6 +1943,7 @@ export class Terminal implements ITerminalCore {
1938
1943
  * Show scrollbar with fade-in and schedule auto-hide
1939
1944
  */
1940
1945
  private showScrollbar(): void {
1946
+ if (!this.options.scrollbar) return;
1941
1947
  this.wake();
1942
1948
  // Clear any existing hide timeout
1943
1949
  if (this.scrollbarHideTimeout) {
@@ -1963,6 +1969,19 @@ export class Terminal implements ITerminalCore {
1963
1969
  }
1964
1970
  }
1965
1971
 
1972
+ private dropScrollbar(): void {
1973
+ this.wake();
1974
+ if (this.scrollbarHideTimeout) {
1975
+ window.clearTimeout(this.scrollbarHideTimeout);
1976
+ this.scrollbarHideTimeout = undefined;
1977
+ }
1978
+ this.isDraggingScrollbar = false;
1979
+ this.scrollbarDragStart = null;
1980
+ this.scrollbarVisible = false;
1981
+ this.scrollbarOpacity = 0;
1982
+ this.draw(true, 0);
1983
+ }
1984
+
1966
1985
  /**
1967
1986
  * Hide scrollbar with fade-out
1968
1987
  */
@@ -1985,6 +2004,7 @@ export class Terminal implements ITerminalCore {
1985
2004
  this.wake();
1986
2005
  const startTime = Date.now();
1987
2006
  const animate = () => {
2007
+ if (!this.options.scrollbar) return;
1988
2008
  const elapsed = Date.now() - startTime;
1989
2009
  const progress = Math.min(elapsed / this.SCROLLBAR_FADE_DURATION_MS, 1);
1990
2010
  this.scrollbarOpacity = progress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurigax-ai/ghostty-web",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Ghostty's terminal engine (libghostty-vt) in the browser: WebAssembly build, an xterm.js-shaped API and WebGL and canvas renderers. A hard fork of coder/ghostty-web.",
5
5
  "type": "module",
6
6
  "main": "./lib/index.ts",