Add attributesEqual and underline diff APIs#5682
Merged
Tyriar merged 3 commits intoxtermjs:masterfrom Feb 7, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Exposes additional buffer cell attribute APIs (underline style/color + attribute diffing) to make it easier for consumers/addons to compare cell styling without reimplementing internal logic.
Changes:
- Add
IBufferCellunderline getters and newattributesEqualsmethod to the public typings (browser + headless). - Implement
attributesEqualsonCellDataand add unit/integration coverage for underline-style/color comparisons. - Update SerializeAddon to use the new public underline APIs and optimize style diffing.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| typings/xterm.d.ts | Adds new IBufferCell underline getters + attributesEquals to the public browser typings. |
| typings/xterm-headless.d.ts | Mirrors the new IBufferCell underline getters + attributesEquals in headless typings. |
| src/common/public/BufferLineApiView.ts | Adjusts casting around loadCell to account for updated public IBufferCell shape. |
| src/common/buffer/CellData.ts | Implements attributesEquals on the internal CellData used to back public buffer cells. |
| src/common/buffer/CellData.test.ts | New unit tests validating attributesEquals, including underline-related exclusions. |
| src/browser/services/SelectionService.ts | Broadens _isCharWordSeparator to accept ICellData (typing alignment). |
| src/browser/renderer/dom/DomRendererRowFactory.ts | Tightens a local variable type to ICellData (typing alignment). |
| addons/addon-serialize/test/SerializeAddon.test.ts | Adds Playwright coverage for attributesEquals behavior on real buffer cells. |
| addons/addon-serialize/src/SerializeAddon.ts | Uses new underline getters and leverages attributesEquals when available to shortcut diffs. |
| addons/addon-serialize/src/SerializeAddon.test.ts | Updates expectation for single-underline serialization to emit SGR 4 instead of SGR 4:1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3440