Add block to cursorInactiveStyle,

change line to bar
This commit is contained in:
tisilent
2023-08-11 11:36:40 +08:00
parent 0321bcb715
commit 5c1e6dce99
7 changed files with 30 additions and 33 deletions
@@ -58,7 +58,8 @@ export class CursorRenderLayer extends BaseRenderLayer {
this._cursorRenderers = {
'bar': this._renderBarCursor.bind(this),
'block': this._renderBlockCursor.bind(this),
'underline': this._renderUnderlineCursor.bind(this)
'underline': this._renderUnderlineCursor.bind(this),
'outline': this._renderOutlineCursor.bind(this)
};
this.register(optionsService.onOptionChange(() => this._handleOptionsChanged()));
this._handleOptionsChanged();
@@ -150,13 +151,9 @@ export class CursorRenderLayer extends BaseRenderLayer {
this._ctx.save();
this._ctx.fillStyle = this._themeService.colors.cursor.css;
const cursorStyle = this._optionsService.rawOptions.cursorStyle;
if (this._optionsService.rawOptions.cursorInactiveStyle === 'outline') {
this._renderBlurCursor(cursorX, viewportRelativeCursorY, this._cell);
} else if (this._optionsService.rawOptions.cursorInactiveStyle === 'line') {
this._cursorRenderers['bar'](cursorX, viewportRelativeCursorY, this._cell);
} else if (this._optionsService.rawOptions.cursorInactiveStyle === 'underline') {
this._cursorRenderers['underline'](cursorX, viewportRelativeCursorY, this._cell);
} else {
const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;
if (cursorInactiveStyle && cursorInactiveStyle !== 'none') {
this._cursorRenderers[cursorInactiveStyle](cursorX, viewportRelativeCursorY, this._cell);
}
this._ctx.restore();
this._state.x = cursorX;
@@ -238,7 +235,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
this._ctx.restore();
}
private _renderBlurCursor(x: number, y: number, cell: ICellData): void {
private _renderOutlineCursor(x: number, y: number, cell: ICellData): void {
this._ctx.save();
this._ctx.strokeStyle = this._themeService.colors.cursor.css;
this._strokeRectAtCell(x, y, cell.getWidth(), 1);