Compare commits

...
Author SHA1 Message Date
Daniel Imms 041d3bc3db Merge branch 'master' into cursor/cross-cutting-doc-comments-cf99 2026-06-01 08:35:08 -07:00
Daniel Imms ea2a506142 Merge branch 'master' into cursor/cross-cutting-doc-comments-cf99 2026-06-01 08:31:31 -07:00
Daniel ImmsandCursor 5527814e08 docs: fix suppress and addressable spelling in mouse comments
Correct "supress"/"addressible" to "suppress"/"addressable" in
MouseStateService, MouseService tests, and InputHandler test titles.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:34 +00:00
Daniel ImmsandCursor d47ea40010 docs: fix comment typos in Constants, DomRenderer, and addons
- Constants: "indicating" in combined-content flag JSDoc
- DomRenderer: viewportStartRow spelling in comment
- SerializeAddon: "simplify" instead of "simply"
- addon-ligatures: "terminal" instead of "therminal"

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:34 +00:00
Daniel ImmsandCursor c78f77cc17 docs: fix comment typos in BufferReflow, Types, and addons
- BufferReflow: name reflowLarger correctly; "Creates and returns"
- Types: "suppress" spelling in CoreMouseEncoding JSDoc
- SerializeAddon.test: "at the end" and "specific" in workaround comment
- WebglRenderer: remove duplicate "The" in canvas size comment

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:34 +00:00
Daniel ImmsandCursor ebe7af5bf4 docs: fix typos in typings, tests, and core comments
- addon-clipboard: "Note that this" instead of duplicate "this"
- addon-webgl: remove stray "the" before "a" in event JSDoc
- SharedRendererTests: duplicate "the" in test title
- Types: "protocol" spelling in CoreMouseEncoding JSDoc
- InputHandler: "a replacement char" article fix

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:33 +00:00
Daniel ImmsandCursor faaa549355 fix: small comment, error string, and guard cleanups
- Services JSDoc: "to determine" grapheme clustering wording
- AttributeData: "persistent" spelling in comment
- Buffer.setupTabStops: check only `undefined` (param is `number | undefined`)
- SerializeAddon: fix "we must" and duplicate "the" in comment
- WebglAddon: use "WebGL2" in Safari support error for consistency
- TextureAtlas: "relevant" spelling in comment

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:33 +00:00
Daniel ImmsandCursor 1e554992f6 docs: fix additional comment typos across renderer and selection
Correct scrambled FIXME wording in InputHandler, "however" in
DomRenderer, duplicate "the" in selection code, "separate" and grammar
in DomRendererRowFactory, and "may cause" in WebglRenderer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:33 +00:00
22 changed files with 31 additions and 31 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ declare module '@xterm/addon-clipboard' {
/** /**
* The clipboard provider interface that enables xterm.js to access the browser clipboard. * The clipboard provider interface that enables xterm.js to access the browser clipboard.
* *
* Note this this clipboard provider does not implement own cut buffers as xterm does, * Note that this clipboard provider does not implement own cut buffers as xterm does,
* but redirect the selection parameter always to navigator.clipboard. * but redirect the selection parameter always to navigator.clipboard.
*/ */
export class BrowserClipboardProvider implements IClipboardProvider{ export class BrowserClipboardProvider implements IClipboardProvider{
+1 -1
View File
@@ -21,7 +21,7 @@ const CACHE_SIZE = 100000;
/** /**
* Enable ligature support for the provided Terminal instance. To function * Enable ligature support for the provided Terminal instance. To function
* properly, this must be called after `open()` is called on the therminal. If * properly, this must be called after `open()` is called on the terminal. If
* the font currently in use supports ligatures, the terminal will automatically * the font currently in use supports ligatures, the terminal will automatically
* start to render them. * start to render them.
* @param term Terminal instance from xterm.js * @param term Terminal instance from xterm.js
+3 -3
View File
@@ -173,7 +173,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
private _thisRowLastSecondChar: IBufferCell = this._buffer.getNullCell(); private _thisRowLastSecondChar: IBufferCell = this._buffer.getNullCell();
private _nextRowFirstChar: IBufferCell = this._buffer.getNullCell(); private _nextRowFirstChar: IBufferCell = this._buffer.getNullCell();
protected _rowEnd(row: number, isLastRow: boolean): void { protected _rowEnd(row: number, isLastRow: boolean): void {
// if there is colorful empty cell at line end, whe must pad it back, or the the color block // if there is colorful empty cell at line end, we must pad it back, or the color block
// will missing // will missing
if (this._nullCellCount > 0 && !equalBg(this._cursorStyle, this._backgroundCell)) { if (this._nullCellCount > 0 && !equalBg(this._cursorStyle, this._backgroundCell)) {
// use clear right to set background. // use clear right to set background.
@@ -221,7 +221,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
// you can't use control sequence to move cursor to (x === row) // you can't use control sequence to move cursor to (x === row)
(thisRowLastChar.getChars() || thisRowLastChar.getWidth() === 0) && (thisRowLastChar.getChars() || thisRowLastChar.getWidth() === 0) &&
// change background of the first wrapped cell also affects BCE // change background of the first wrapped cell also affects BCE
// so we mark it as invalid to simply the process to determine line separator // so we mark it as invalid to simplify the process to determine line separator
equalBg(thisRowLastChar, nextRowFirstChar) equalBg(thisRowLastChar, nextRowFirstChar)
) { ) {
isValid = true; isValid = true;
@@ -233,7 +233,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
isNextRowFirstCharDoubleWidth && isNextRowFirstCharDoubleWidth &&
(thisRowLastSecondChar.getChars() || thisRowLastSecondChar.getWidth() === 0) && (thisRowLastSecondChar.getChars() || thisRowLastSecondChar.getWidth() === 0) &&
// change background of the first wrapped cell also affects BCE // change background of the first wrapped cell also affects BCE
// so we mark it as invalid to simply the process to determine line separator // so we mark it as invalid to simplify the process to determine line separator
equalBg(thisRowLastChar, nextRowFirstChar) && equalBg(thisRowLastChar, nextRowFirstChar) &&
equalBg(thisRowLastSecondChar, nextRowFirstChar) equalBg(thisRowLastSecondChar, nextRowFirstChar)
) { ) {
@@ -192,7 +192,7 @@ test.describe('SerializeAddon', () => {
const cols = 10; const cols = 10;
const line = '+'.repeat(cols); const line = '+'.repeat(cols);
const lines: string[] = [ const lines: string[] = [
sgr(FG_P16_GREEN) + line, // Workaround: If we clear all flags a the end, serialize will use \x1b[0m to clear instead of the sepcific disable sequence sgr(FG_P16_GREEN) + line, // Workaround: If we clear all flags at the end, serialize will use \x1b[0m to clear instead of the specific disable sequence
sgr(INVERSE) + line, sgr(INVERSE) + line,
sgr(BOLD) + line, sgr(BOLD) + line,
sgr(UNDERLINED) + line, sgr(UNDERLINED) + line,
+1 -1
View File
@@ -1125,7 +1125,7 @@ function clearColor(imageData: ImageData, bg: IColor, fg: IColor, enableThreshol
// were covered (fg=#8ae234, bg=#c4a000). // were covered (fg=#8ae234, bg=#c4a000).
const threshold = Math.floor((Math.abs(r - fgR) + Math.abs(g - fgG) + Math.abs(b - fgB)) / 12); const threshold = Math.floor((Math.abs(r - fgR) + Math.abs(g - fgG) + Math.abs(b - fgB)) / 12);
// Set alpha channel of relevent pixels to 0 // Set alpha channel of relevant pixels to 0
let isEmpty = true; let isEmpty = true;
for (let offset = 0; offset < imageData.data.length; offset += 4) { for (let offset = 0; offset < imageData.data.length; offset += 4) {
// Check exact match // Check exact match
+1 -1
View File
@@ -40,7 +40,7 @@ export class WebglAddon extends Disposable implements ITerminalAddon, IWebglApi
}; };
const gl = document.createElement('canvas').getContext('webgl2', contextAttributes) as IWebGL2RenderingContext; const gl = document.createElement('canvas').getContext('webgl2', contextAttributes) as IWebGL2RenderingContext;
if (!gl) { if (!gl) {
throw new Error('Webgl2 is only supported on Safari 16 and above'); throw new Error('WebGL2 is only supported on Safari 16 and above');
} }
} }
super(); super();
+2 -2
View File
@@ -664,10 +664,10 @@ export class WebglRenderer extends Disposable implements IRenderer {
this.dimensions.device.canvas.height = this._terminal.rows * this.dimensions.device.cell.height; this.dimensions.device.canvas.height = this._terminal.rows * this.dimensions.device.cell.height;
this.dimensions.device.canvas.width = this._terminal.cols * this.dimensions.device.cell.width; this.dimensions.device.canvas.width = this._terminal.cols * this.dimensions.device.cell.width;
// The the size of the canvas on the page. It's important that this rounds to nearest integer // The size of the canvas on the page. It's important that this rounds to nearest integer
// and not ceils as browsers often have floating point precision issues where // and not ceils as browsers often have floating point precision issues where
// `window.devicePixelRatio` ends up being something like `1.100000023841858` for example, when // `window.devicePixelRatio` ends up being something like `1.100000023841858` for example, when
// it's actually 1.1. Ceiling may causes blurriness as the backing canvas image is 1 pixel too // it's actually 1.1. Ceiling may cause blurriness as the backing canvas image is 1 pixel too
// large for the canvas element size. // large for the canvas element size.
this.dimensions.css.canvas.height = Math.round(this.dimensions.device.canvas.height / this._devicePixelRatio); this.dimensions.css.canvas.height = Math.round(this.dimensions.device.canvas.height / this._devicePixelRatio);
this.dimensions.css.canvas.width = Math.round(this.dimensions.device.canvas.width / this._devicePixelRatio); this.dimensions.css.canvas.width = Math.round(this.dimensions.device.canvas.width / this._devicePixelRatio);
+2 -2
View File
@@ -23,12 +23,12 @@ declare module '@xterm/addon-webgl' {
public readonly onChangeTextureAtlas: IEvent<HTMLCanvasElement>; public readonly onChangeTextureAtlas: IEvent<HTMLCanvasElement>;
/** /**
* An event that is fired when the a new page is added to the texture atlas. * An event that is fired when a new page is added to the texture atlas.
*/ */
public readonly onAddTextureAtlasCanvas: IEvent<HTMLCanvasElement>; public readonly onAddTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
/** /**
* An event that is fired when the a page is removed from the texture atlas. * An event that is fired when a page is removed from the texture atlas.
*/ */
public readonly onRemoveTextureAtlasCanvas: IEvent<HTMLCanvasElement>; public readonly onRemoveTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
+2 -2
View File
@@ -33,7 +33,7 @@ let nextTerminalId = 1;
/** /**
* The standard renderer and fallback for when the webgl addon is slow. This is not meant to be * The standard renderer and fallback for when the webgl addon is slow. This is not meant to be
* particularly fast and will even lack some features such as custom glyphs, hoever this is more * particularly fast and will even lack some features such as custom glyphs, however this is more
* reliable as webgl may not work on some machines. * reliable as webgl may not work on some machines.
*/ */
export class DomRenderer extends Disposable implements IRenderer { export class DomRenderer extends Disposable implements IRenderer {
@@ -430,7 +430,7 @@ export class DomRenderer extends Disposable implements IRenderer {
documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow + 1, 0, this._bufferService.cols, middleRowsCount)); documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow + 1, 0, this._bufferService.cols, middleRowsCount));
// Draw final row // Draw final row
if (viewportCappedStartRow !== viewportCappedEndRow) { if (viewportCappedStartRow !== viewportCappedEndRow) {
// Only draw viewportEndRow if it's not the same as viewporttartRow // Only draw viewportEndRow if it's not the same as viewportStartRow
const finalEndCol = viewportEndRow === viewportCappedEndRow ? end[0] : this._bufferService.cols; const finalEndCol = viewportEndRow === viewportCappedEndRow ? end[0] : this._bufferService.cols;
documentFragment.appendChild(this._createSelectionElement(viewportCappedEndRow, 0, finalEndCol)); documentFragment.appendChild(this._createSelectionElement(viewportCappedEndRow, 0, finalEndCol));
} }
@@ -380,7 +380,7 @@ export class DomRendererRowFactory {
if (!isTop && isInSelection) { if (!isTop && isInSelection) {
// If in the selection, force the element to be above the selection to improve contrast and // If in the selection, force the element to be above the selection to improve contrast and
// support opaque selections. The applies background is not actually needed here as // support opaque selections. The applies background is not actually needed here as
// selection is drawn in a seperate container, the main purpose of this to ensuring minimum // selection is drawn in a separate container; the main purpose of this is to ensure minimum
// contrast ratio // contrast ratio
bgOverride = this._coreBrowserService.isFocused ? colors.selectionBackgroundOpaque : colors.selectionInactiveBackgroundOpaque; bgOverride = this._coreBrowserService.isFocused ? colors.selectionBackgroundOpaque : colors.selectionInactiveBackgroundOpaque;
bg = bgOverride.rgba >> 8 & 0xFFFFFF; bg = bgOverride.rgba >> 8 & 0xFFFFFF;
+1 -1
View File
@@ -88,7 +88,7 @@ export class SelectionModel {
return [startPlusLength, this.selectionStart[1]]; return [startPlusLength, this.selectionStart[1]];
} }
// Ensure the the word/line is selected after a double/triple click // Ensure the word/line is selected after a double/triple click
if (this.selectionStartLength) { if (this.selectionStartLength) {
// Select the larger of the two when start and end are on the same line // Select the larger of the two when start and end are on the same line
if (this.selectionEnd[1] === this.selectionStart[1]) { if (this.selectionEnd[1] === this.selectionStart[1]) {
+1 -1
View File
@@ -176,7 +176,7 @@ describe('MouseService _triggerMouseEvent', () => {
for (let i = 0; i < bufferService.cols; ++i) { for (let i = 0; i < bufferService.cols; ++i) {
assert.equal(trigger({ col: i, row: 0, x: 0, y: 0, button: CoreMouseButton.LEFT, action: CoreMouseAction.DOWN }), true); assert.equal(trigger({ col: i, row: 0, x: 0, y: 0, button: CoreMouseButton.LEFT, action: CoreMouseAction.DOWN }), true);
if (i > 222) { if (i > 222) {
// supress mouse reports if we are out of addressible range (max. 222) // suppress mouse reports if we are out of addressable range (max. 222)
assert.deepEqual(toBytes(reports.pop()), []); assert.deepEqual(toBytes(reports.pop()), []);
} else { } else {
assert.deepEqual(toBytes(reports.pop()), [0x1b, 0x5b, 0x4d, 0x20, i + 33, 0x21]); assert.deepEqual(toBytes(reports.pop()), [0x1b, 0x5b, 0x4d, 0x20, i + 33, 0x21]);
+2 -2
View File
@@ -927,7 +927,7 @@ export class SelectionService extends Disposable implements ISelectionService {
// Incremenet the end index so it is at the start of the next character // Incremenet the end index so it is at the start of the next character
endIndex++; endIndex++;
// Calculate the start _column_, converting the the string indexes back to // Calculate the start _column_, converting the string indexes back to
// column coordinates. // column coordinates.
let start = let start =
startIndex // The index of the selection's start char in the line string startIndex // The index of the selection's start char in the line string
@@ -935,7 +935,7 @@ export class SelectionService extends Disposable implements ISelectionService {
- leftWideCharCount // The number of wide chars left of the initial char - leftWideCharCount // The number of wide chars left of the initial char
+ leftLongCharOffset; // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis) + leftLongCharOffset; // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)
// Calculate the length in _columns_, converting the the string indexes back // Calculate the length in _columns_, converting the string indexes back
// to column coordinates. // to column coordinates.
let length = Math.min(this._bufferService.cols, // Disallow lengths larger than the terminal cols let length = Math.min(this._bufferService.cols, // Disallow lengths larger than the terminal cols
endIndex // The index of the selection's end char in the line string endIndex // The index of the selection's end char in the line string
+1 -1
View File
@@ -1241,7 +1241,7 @@ describe('InputHandler', () => {
await inputHandler.parseP('\x1b[e'); await inputHandler.parseP('\x1b[e');
assert.deepEqual(getCursor(bufferService), [8, 5]); assert.deepEqual(getCursor(bufferService), [8, 5]);
}); });
describe('should clamp cursor into addressible range', () => { describe('should clamp cursor into addressable range', () => {
it('CUF', async () => { it('CUF', async () => {
bufferService.buffer.x = 10000; bufferService.buffer.x = 10000;
bufferService.buffer.y = 10000; bufferService.buffer.y = 10000;
+2 -2
View File
@@ -273,7 +273,7 @@ export class InputHandler extends Disposable implements IInputHandler {
this._parser.setExecuteHandler(C0.HT, () => this.tab()); this._parser.setExecuteHandler(C0.HT, () => this.tab());
this._parser.setExecuteHandler(C0.SO, () => this.shiftOut()); this._parser.setExecuteHandler(C0.SO, () => this.shiftOut());
this._parser.setExecuteHandler(C0.SI, () => this.shiftIn()); this._parser.setExecuteHandler(C0.SI, () => this.shiftIn());
// FIXME: What do to with missing? Old code just added those to print. // FIXME: What to do with missing? Old code just added those to print.
this._parser.setExecuteHandler(C1.IND, () => this.index()); this._parser.setExecuteHandler(C1.IND, () => this.index());
this._parser.setExecuteHandler(C1.NEL, () => this.nextLine()); this._parser.setExecuteHandler(C1.NEL, () => this.nextLine());
@@ -550,7 +550,7 @@ export class InputHandler extends Disposable implements IInputHandler {
// get charset replacement character // get charset replacement character
// charset is only defined for ASCII, therefore we only // charset is only defined for ASCII, therefore we only
// search for an replacement char if code < 127 // search for a replacement char if code < 127
if (code < 127 && charset) { if (code < 127 && charset) {
const ch = charset[String.fromCharCode(code)]; const ch = charset[String.fromCharCode(code)];
if (ch) { if (ch) {
+2 -2
View File
@@ -234,9 +234,9 @@ export interface ICoreMouseProtocol {
/** /**
* CoreMouseEncoding * CoreMouseEncoding
* The tracking encoding can be registered and activated at the MouseStateService. * The tracking encoding can be registered and activated at the MouseStateService.
* If a ICoreMouseEvent passes all procotol restrictions it will be encoded * If a ICoreMouseEvent passes all protocol restrictions it will be encoded
* with the active encoding and sent out. * with the active encoding and sent out.
* Note: Returning an empty string will supress sending a mouse report, * Note: Returning an empty string will suppress sending a mouse report,
* which can be used to skip creating falsey reports in limited encodings * which can be used to skip creating falsey reports in limited encodings
* (DEFAULT only supports up to 223 1-based as coord value). * (DEFAULT only supports up to 223 1-based as coord value).
*/ */
+1 -1
View File
@@ -204,7 +204,7 @@ export class ExtendedAttrs implements IExtendedAttrs {
/** /**
* Convenient method to indicate whether the object holds no additional information, * Convenient method to indicate whether the object holds no additional information,
* that needs to be persistant in the buffer. * that needs to be persistent in the buffer.
*/ */
public isEmpty(): boolean { public isEmpty(): boolean {
return this.underlineStyle === UnderlineStyle.NONE && this._urlId === 0; return this.underlineStyle === UnderlineStyle.NONE && this._urlId === 0;
+1 -1
View File
@@ -578,7 +578,7 @@ export class Buffer extends Disposable implements IBuffer {
* @param i The index to start setting up tab stops from. * @param i The index to start setting up tab stops from.
*/ */
public setupTabStops(i?: number): void { public setupTabStops(i?: number): void {
if (i !== null && i !== undefined) { if (i !== undefined) {
if (!this.tabs[i]) { if (!this.tabs[i]) {
i = this.prevStop(i); i = this.prevStop(i);
} }
+2 -2
View File
@@ -13,7 +13,7 @@ export interface INewLayoutResult {
} }
/** /**
* Evaluates and returns indexes to be removed after a reflow larger occurs. Lines will be removed * Evaluates and returns indexes to be removed after reflowLarger occurs. Lines will be removed
* when a wrapped line unwraps. * when a wrapped line unwraps.
* @param lines The buffer lines. * @param lines The buffer lines.
* @param oldCols The columns before resize * @param oldCols The columns before resize
@@ -109,7 +109,7 @@ export function reflowLargerGetLinesToRemove(lines: CircularList<IBufferLine>, o
} }
/** /**
* Creates and return the new layout for lines given an array of indexes to be removed. * Creates and returns the new layout for lines given an array of indexes to be removed.
* @param lines The buffer lines. * @param lines The buffer lines.
* @param toRemove The indexes to remove. * @param toRemove The indexes to remove.
*/ */
+1 -1
View File
@@ -126,7 +126,7 @@ const DEFAULT_ENCODINGS: { [key: string]: CoreMouseEncoding } = {
*/ */
DEFAULT: (e: ICoreMouseEvent) => { DEFAULT: (e: ICoreMouseEvent) => {
const params = [eventCode(e, false) + 32, e.col + 32, e.row + 32]; const params = [eventCode(e, false) + 32, e.col + 32, e.row + 32];
// supress mouse report if we exceed addressible range // suppress mouse report if we exceed addressable range
// Note this is handled differently by emulators // Note this is handled differently by emulators
// - xterm: sends 0;0 coords instead // - xterm: sends 0;0 coords instead
// - vte, konsole: no report // - vte, konsole: no report
+1 -1
View File
@@ -324,7 +324,7 @@ export interface IOscLinkService {
* bit 0: shouldJoin - should combine with preceding character. * bit 0: shouldJoin - should combine with preceding character.
* bit 1..2: wcwidth - see UnicodeCharWidth. * bit 1..2: wcwidth - see UnicodeCharWidth.
* bit 3..31: class of character (currently only 4 bits are used). * bit 3..31: class of character (currently only 4 bits are used).
* This is used to determined grapheme clustering - i.e. which codepoints * This is used to determine grapheme clustering - i.e. which codepoints
* are to be combined into a single compound character. * are to be combined into a single compound character.
* *
* Use the UnicodeService static function createPropertyValue to create a * Use the UnicodeService static function createPropertyValue to create a
+1 -1
View File
@@ -980,7 +980,7 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
}); });
test.describe('selectionInactiveBackground', async () => { test.describe('selectionInactiveBackground', async () => {
test('should render the the inactive selection when not focused', async () => { test('should render the inactive selection when not focused', async () => {
const theme: ITheme = { const theme: ITheme = {
selectionBackground: '#FF000080', selectionBackground: '#FF000080',
selectionInactiveBackground: '#0000FF80' selectionInactiveBackground: '#0000FF80'