✅ Rust PTY backend (portable-pty) - pty_spawn / pty_write / pty_resize / pty_kill commands - Output streamed via pty:data Tauri events (base64-encoded bytes) - Spawns /bin/bash (falls back to /bin/bash), starts in /home/code ✅ xterm.js terminal card (full ANSI + true color) ✅ Toolbar (top-left) with + Note / + Terminal ✅ Shared useDragHandle hook (notes + terminals) ✅ Terminal font-size scales with canvas zoom → crisp at any zoom ✅ Terminal auto-refits when card resizes or zoom changes
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
/**
|
|
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
|
|
* @license MIT
|
|
*/
|
|
|
|
import { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from '@xterm/xterm';
|
|
import { IBuffer } from 'common/buffer/Types';
|
|
import { BufferLineApiView } from 'common/public/BufferLineApiView';
|
|
import { CellData } from 'common/buffer/CellData';
|
|
|
|
export class BufferApiView implements IBufferApi {
|
|
constructor(
|
|
private _buffer: IBuffer,
|
|
public readonly type: 'normal' | 'alternate'
|
|
) { }
|
|
|
|
public init(buffer: IBuffer): BufferApiView {
|
|
this._buffer = buffer;
|
|
return this;
|
|
}
|
|
|
|
public get cursorY(): number { return this._buffer.y; }
|
|
public get cursorX(): number { return this._buffer.x; }
|
|
public get viewportY(): number { return this._buffer.ydisp; }
|
|
public get baseY(): number { return this._buffer.ybase; }
|
|
public get length(): number { return this._buffer.lines.length; }
|
|
public getLine(y: number): IBufferLineApi | undefined {
|
|
const line = this._buffer.lines.get(y);
|
|
if (!line) {
|
|
return undefined;
|
|
}
|
|
return new BufferLineApiView(line);
|
|
}
|
|
public getNullCell(): IBufferCellApi { return new CellData(); }
|
|
}
|