Merge branch 'master' into fix-caps-lock-ime
This commit is contained in:
@@ -81,7 +81,7 @@ export class SearchAddon implements ITerminalAddon {
|
|||||||
}
|
}
|
||||||
if (this._cachedSearchTerm && this._lastSearchOptions?.decorations) {
|
if (this._cachedSearchTerm && this._lastSearchOptions?.decorations) {
|
||||||
this._highlightTimeout = setTimeout(() => {
|
this._highlightTimeout = setTimeout(() => {
|
||||||
this.findPrevious(this._cachedSearchTerm!, { ...this._lastSearchOptions, incremental: true });
|
this._highlightAllMatches(this._cachedSearchTerm!, { ...this._lastSearchOptions, incremental: true });
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -216,8 +216,8 @@ export class WebglCharAtlas implements IDisposable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getForegroundCss(bg: number, bgColorMode: number, bgColor: number, fg: number, fgColorMode: number, fgColor: number, inverse: boolean, bold: boolean): string {
|
private _getForegroundCss(bg: number, bgColorMode: number, bgColor: number, fg: number, fgColorMode: number, fgColor: number, inverse: boolean, bold: boolean, isPowerLineGlyph: boolean): string {
|
||||||
const minimumContrastCss = this._getMinimumContrastCss(bg, bgColorMode, bgColor, fg, fgColorMode, fgColor, inverse, bold);
|
const minimumContrastCss = this._getMinimumContrastCss(bg, bgColorMode, bgColor, fg, fgColorMode, fgColor, inverse, bold, isPowerLineGlyph);
|
||||||
if (minimumContrastCss) {
|
if (minimumContrastCss) {
|
||||||
return minimumContrastCss;
|
return minimumContrastCss;
|
||||||
}
|
}
|
||||||
@@ -281,8 +281,8 @@ export class WebglCharAtlas implements IDisposable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getMinimumContrastCss(bg: number, bgColorMode: number, bgColor: number, fg: number, fgColorMode: number, fgColor: number, inverse: boolean, bold: boolean): string | undefined {
|
private _getMinimumContrastCss(bg: number, bgColorMode: number, bgColor: number, fg: number, fgColorMode: number, fgColor: number, inverse: boolean, bold: boolean, isPowerLineGlyph: boolean): string | undefined {
|
||||||
if (this._config.minimumContrastRatio === 1) {
|
if (this._config.minimumContrastRatio === 1 || isPowerLineGlyph) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,13 +370,6 @@ export class WebglCharAtlas implements IDisposable {
|
|||||||
`${fontStyle} ${fontWeight} ${this._config.fontSize * this._config.devicePixelRatio}px ${this._config.fontFamily}`;
|
`${fontStyle} ${fontWeight} ${this._config.fontSize * this._config.devicePixelRatio}px ${this._config.fontFamily}`;
|
||||||
this._tmpCtx.textBaseline = TEXT_BASELINE;
|
this._tmpCtx.textBaseline = TEXT_BASELINE;
|
||||||
|
|
||||||
this._tmpCtx.fillStyle = this._getForegroundCss(bg, bgColorMode, bgColor, fg, fgColorMode, fgColor, inverse, bold);
|
|
||||||
|
|
||||||
// Apply alpha to dim the character
|
|
||||||
if (dim) {
|
|
||||||
this._tmpCtx.globalAlpha = DIM_OPACITY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the char is a powerline glyph, these will be restricted to a single cell glyph, no
|
// Check if the char is a powerline glyph, these will be restricted to a single cell glyph, no
|
||||||
// padding on either side that are allowed for other glyphs since they are designed to be pixel
|
// padding on either side that are allowed for other glyphs since they are designed to be pixel
|
||||||
// perfect but may render with "bad" anti-aliasing
|
// perfect but may render with "bad" anti-aliasing
|
||||||
@@ -387,6 +380,12 @@ export class WebglCharAtlas implements IDisposable {
|
|||||||
isPowerlineGlyph = true;
|
isPowerlineGlyph = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this._tmpCtx.fillStyle = this._getForegroundCss(bg, bgColorMode, bgColor, fg, fgColorMode, fgColor, inverse, bold, isPowerlineGlyph);
|
||||||
|
|
||||||
|
// Apply alpha to dim the character
|
||||||
|
if (dim) {
|
||||||
|
this._tmpCtx.globalAlpha = DIM_OPACITY;
|
||||||
|
}
|
||||||
|
|
||||||
// For powerline glyphs left/top padding is excluded (https://github.com/microsoft/vscode/issues/120129)
|
// For powerline glyphs left/top padding is excluded (https://github.com/microsoft/vscode/issues/120129)
|
||||||
const padding = isPowerlineGlyph ? 0 : TMP_CANVAS_GLYPH_PADDING;
|
const padding = isPowerlineGlyph ? 0 : TMP_CANVAS_GLYPH_PADDING;
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export class OverviewRulerRenderer extends Disposable {
|
|||||||
*/
|
*/
|
||||||
private _registerDecorationListeners(): void {
|
private _registerDecorationListeners(): void {
|
||||||
this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(undefined, true)));
|
this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(undefined, true)));
|
||||||
|
this.register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(undefined, true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -428,6 +428,11 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _getContrastColor(cell: CellData): IColor | undefined {
|
private _getContrastColor(cell: CellData): IColor | undefined {
|
||||||
|
const codepoint = cell.getCode();
|
||||||
|
if (57344 <= codepoint && codepoint <= 63743) {
|
||||||
|
// powerline chars #3739
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
if (this._optionsService.rawOptions.minimumContrastRatio === 1) {
|
if (this._optionsService.rawOptions.minimumContrastRatio === 1) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IBufferLine } from 'common/Types';
|
import { IBufferLine, ICellData } from 'common/Types';
|
||||||
import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants';
|
import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants';
|
||||||
import { NULL_CELL_CODE, WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants';
|
import { NULL_CELL_CODE, WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants';
|
||||||
import { CellData } from 'common/buffer/CellData';
|
import { CellData } from 'common/buffer/CellData';
|
||||||
@@ -178,7 +178,7 @@ export class DomRendererRowFactory {
|
|||||||
if (cell.isBold() && fg < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors) {
|
if (cell.isBold() && fg < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors) {
|
||||||
fg += 8;
|
fg += 8;
|
||||||
}
|
}
|
||||||
if (!this._applyMinimumContrast(charElement, this._colors.background, this._colors.ansi[fg])) {
|
if (!this._applyMinimumContrast(charElement, this._colors.background, this._colors.ansi[fg], cell)) {
|
||||||
charElement.classList.add(`xterm-fg-${fg}`);
|
charElement.classList.add(`xterm-fg-${fg}`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -188,13 +188,13 @@ export class DomRendererRowFactory {
|
|||||||
(fg >> 8) & 0xFF,
|
(fg >> 8) & 0xFF,
|
||||||
(fg ) & 0xFF
|
(fg ) & 0xFF
|
||||||
);
|
);
|
||||||
if (!this._applyMinimumContrast(charElement, this._colors.background, color)) {
|
if (!this._applyMinimumContrast(charElement, this._colors.background, color, cell)) {
|
||||||
this._addStyle(charElement, `color:#${padStart(fg.toString(16), '0', 6)}`);
|
this._addStyle(charElement, `color:#${padStart(fg.toString(16), '0', 6)}`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Attributes.CM_DEFAULT:
|
case Attributes.CM_DEFAULT:
|
||||||
default:
|
default:
|
||||||
if (!this._applyMinimumContrast(charElement, this._colors.background, this._colors.foreground)) {
|
if (!this._applyMinimumContrast(charElement, this._colors.background, this._colors.foreground, cell)) {
|
||||||
if (isInverse) {
|
if (isInverse) {
|
||||||
charElement.classList.add(`xterm-fg-${INVERTED_DEFAULT_COLOR}`);
|
charElement.classList.add(`xterm-fg-${INVERTED_DEFAULT_COLOR}`);
|
||||||
}
|
}
|
||||||
@@ -224,8 +224,9 @@ export class DomRendererRowFactory {
|
|||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _applyMinimumContrast(element: HTMLElement, bg: IColor, fg: IColor): boolean {
|
private _applyMinimumContrast(element: HTMLElement, bg: IColor, fg: IColor, cell: ICellData): boolean {
|
||||||
if (this._optionsService.rawOptions.minimumContrastRatio === 1) {
|
const codepoint = cell.getCode();
|
||||||
|
if (this._optionsService.rawOptions.minimumContrastRatio === 1 || 57344 <= codepoint && codepoint <= 63743) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export class DecorationService extends Disposable implements IDecorationService
|
|||||||
const index = this._decorations.indexOf(decoration);
|
const index = this._decorations.indexOf(decoration);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
this._decorations.splice(this._decorations.indexOf(decoration), 1);
|
this._decorations.splice(this._decorations.indexOf(decoration), 1);
|
||||||
|
this._onDecorationRemoved.fire(decoration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user