Skip to content

add class for blinking text control code (\x1b[5m) to DOM renderer #5119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/browser/renderer/dom/DomRendererRowFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const enum RowCss {
UNDERLINE_CLASS = 'xterm-underline',
OVERLINE_CLASS = 'xterm-overline',
STRIKETHROUGH_CLASS = 'xterm-strikethrough',
BLINK_CLASS = 'xterm-blink',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd also want the associated CSS class for this in xterm.css if we went with a class

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add an implementation on the webgl side for this so we're not merging in a partially complete feature. Probably the easiest way to implement this in such a way that would share the implementation across multiple renderers is to leverage the decorations service and have an interval to set the transparency of the decoration on and off periodically:

export interface IDecorationService extends IDisposable {
serviceBrand: undefined;
readonly decorations: IterableIterator<IInternalDecoration>;
readonly onDecorationRegistered: Event<IInternalDecoration>;
readonly onDecorationRemoved: Event<IInternalDecoration>;
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the right default is for this, but regardless for accessibility reasons we will want to allow the embedder to disable blinking text. So I think we need some new option to drive this.

CURSOR_CLASS = 'xterm-cursor',
CURSOR_BLINK_CLASS = 'xterm-cursor-blink',
CURSOR_STYLE_BLOCK_CLASS = 'xterm-cursor-block',
Expand Down Expand Up @@ -300,6 +301,10 @@ export class DomRendererRowFactory {
classes.push(RowCss.STRIKETHROUGH_CLASS);
}

if (cell.isBlink()) {
classes.push(RowCss.BLINK_CLASS);
}

// apply link hover underline late, effectively overrides any previous text-decoration
// settings
if (isLinkHover) {
Expand Down