You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As part of #1128 we will be pulling the search addon out of the core repo and into a satellite repo to be published as its own npm module. This is exactly the sort of thing that would be cool for addons to be able to build so we should stabilize some API as right now it hooks into internals. Here's what it touches in buffer:
ydisp
ybase
length
translateBufferLineToString
lines (for isWrapped, length, get width, get char to check if emoji)
Given this, I'm proposing the following API. It resembles the internal structure, but I tweaked a bit here and there to make it more consistent and easier to use (eg. buffer.lines.get -> buffer.getLine):
classTerminal{/** * The terminal's current buffer, note that this might be either the normal * buffer or the alt buffer depending on what's running in the terminal. */buffer: IBuffer;}interfaceIBuffer{/** * The y position of the cursor. This ranges between `0` (when the * cursor is at baseY) and `Terminal.rows - 1` (when the cursor is on the * last row). */readonlycursorY: number;/** * The x position of the cursor. This ranges between `0` (left side) and * `Terminal.cols - 1` (right side). */readonlycursorX: number;/** * The line within the buffer where the top of the viewport is. */readonlyviewportY: number;/** * The line within the buffer where the top of the bottom page is (when * fully scrolled down); */readonlybaseY: number;/** * The amount of lines in the buffer. */readonlylength: number;/** * Gets a line from the buffer. * * @param y The line index to get. */getLine(y: number): IBufferLine;}interfaceIBufferLine{/** * Whether the line is wrapped from the previous line. */readonlyisWrapped: boolean;/** * Gets a cell from the line. * * @param x The character index to get. */getCell(x: number): IBufferCell;/** * Gets the line */translateToString(trimRight: boolean,startColumn: number,endColumn: number): string;}interfaceIBufferCell{/** * The character within the cell. */readonlychar: number;/** * The width of the character. Some examples: * * - This is `1` for most cells. * - This is `2` for wide character like CJK glyphs. * - This is `0` for cells immediately following cells with a width of `2`. */readonlywidth: number;}
The text was updated successfully, but these errors were encountered:
As part of #1128 we will be pulling the search addon out of the core repo and into a satellite repo to be published as its own npm module. This is exactly the sort of thing that would be cool for addons to be able to build so we should stabilize some API as right now it hooks into internals. Here's what it touches in buffer:
Given this, I'm proposing the following API. It resembles the internal structure, but I tweaked a bit here and there to make it more consistent and easier to use (eg.
buffer.lines.get
->buffer.getLine
):The text was updated successfully, but these errors were encountered: