Merge pull request #4657 from tisilent/add-cursorInactiveStyle-option

Add cursorInactiveStyle option
This commit is contained in:
Daniel Imms
2023-08-11 13:16:51 -07:00
committed by GitHub
12 changed files with 133 additions and 67 deletions
@@ -255,7 +255,7 @@ export class RectangleRenderer extends Disposable {
let offset: number;
let rectangleCount = 0;
if (cursor.style === 'bar' || cursor.style === 'blur') {
if (cursor.style === 'bar' || cursor.style === 'outline') {
// Left edge
offset = rectangleCount++ * INDICES_PER_RECTANGLE;
this._addRectangleFloat(
@@ -268,7 +268,7 @@ export class RectangleRenderer extends Disposable {
this._cursorFloat
);
}
if (cursor.style === 'underline' || cursor.style === 'blur') {
if (cursor.style === 'underline' || cursor.style === 'outline') {
// Bottom edge
offset = rectangleCount++ * INDICES_PER_RECTANGLE;
this._addRectangleFloat(
@@ -281,7 +281,7 @@ export class RectangleRenderer extends Disposable {
this._cursorFloat
);
}
if (cursor.style === 'blur') {
if (cursor.style === 'outline') {
// Top edge
offset = rectangleCount++ * INDICES_PER_RECTANGLE;
this._addRectangleFloat(
+3 -1
View File
@@ -16,11 +16,13 @@ export interface ICursorRenderModel {
x: number;
y: number;
width: number;
style: string;
style: CursorStyle;
cursorWidth: number;
dpr: number;
}
export type CursorStyle = 'outline' | 'block' | 'bar' | 'underline' | 'none';
export interface IWebGL2RenderingContext extends WebGLRenderingContext {
vertexAttribDivisor(index: number, divisor: number): void;
createVertexArray(): IWebGLVertexArrayObject;
@@ -461,15 +461,17 @@ export class WebglRenderer extends Disposable implements IRenderer {
y: this._terminal.buffer.active.cursorY,
width: cell.getWidth(),
style: this._coreBrowserService.isFocused ?
(terminal.options.cursorStyle || 'block') : 'blur',
(terminal.options.cursorStyle || 'block') : terminal.options.cursorInactiveStyle,
cursorWidth: terminal.options.cursorWidth,
dpr: this._devicePixelRatio
};
lastCursorX = cursorX + cell.getWidth() - 1;
}
if (x >= cursorX && x <= lastCursorX &&
this._coreBrowserService.isFocused &&
(terminal.options.cursorStyle || 'block') === 'block') {
((this._coreBrowserService.isFocused &&
(terminal.options.cursorStyle || 'block') === 'block') ||
(this._coreBrowserService.isFocused === false &&
terminal.options.cursorInactiveStyle === 'block'))) {
this._cellColorResolver.result.fg =
Attributes.CM_RGB | (this._themeService.colors.cursorAccent.rgba >> 8 & Attributes.RGB_MASK);
this._cellColorResolver.result.bg =