Merge pull request #2455 from JeffreyCA/unfocused-cursor-style

Update unfocused cursor to match current cursor style
This commit is contained in:
Daniel Imms
2019-10-08 06:43:03 -07:00
committed by GitHub
3 changed files with 23 additions and 13 deletions
@@ -92,10 +92,10 @@ export class CursorRenderLayer extends BaseRenderLayer {
if (this._cursorBlinkStateManager) { if (this._cursorBlinkStateManager) {
this._cursorBlinkStateManager.dispose(); this._cursorBlinkStateManager.dispose();
} }
// Request a refresh from the terminal as management of rendering is being
// moved back to the terminal
terminal.refresh(terminal.buffer.cursorY, terminal.buffer.cursorY);
} }
// Request a refresh from the terminal as management of rendering is being
// moved back to the terminal
terminal.refresh(terminal.buffer.cursorY, terminal.buffer.cursorY);
} }
public onCursorMove(terminal: Terminal): void { public onCursorMove(terminal: Terminal): void {
@@ -139,12 +139,17 @@ export class CursorRenderLayer extends BaseRenderLayer {
this._clearCursor(); this._clearCursor();
this._ctx.save(); this._ctx.save();
this._ctx.fillStyle = this._colors.cursor.css; this._ctx.fillStyle = this._colors.cursor.css;
this._renderBlurCursor(terminal, terminal.buffer.cursorX, viewportRelativeCursorY, this._cell); const cursorStyle = terminal.getOption('cursorStyle');
if (cursorStyle && cursorStyle !== 'block') {
this._cursorRenderers[cursorStyle](terminal, terminal.buffer.cursorX, viewportRelativeCursorY, this._cell);
} else {
this._renderBlurCursor(terminal, terminal.buffer.cursorX, viewportRelativeCursorY, this._cell);
}
this._ctx.restore(); this._ctx.restore();
this._state.x = terminal.buffer.cursorX; this._state.x = terminal.buffer.cursorX;
this._state.y = viewportRelativeCursorY; this._state.y = viewportRelativeCursorY;
this._state.isFocused = false; this._state.isFocused = false;
this._state.style = terminal.getOption('cursorStyle'); this._state.style = cursorStyle;
this._state.width = this._cell.getWidth(); this._state.width = this._cell.getWidth();
return; return;
} }
+10 -5
View File
@@ -103,10 +103,10 @@ export class CursorRenderLayer extends BaseRenderLayer {
this._cursorBlinkStateManager.dispose(); this._cursorBlinkStateManager.dispose();
this._cursorBlinkStateManager = null; this._cursorBlinkStateManager = null;
} }
// Request a refresh from the terminal as management of rendering is being
// moved back to the terminal
this._terminal.refresh(this._bufferService.buffer.y, this._bufferService.buffer.y);
} }
// Request a refresh from the terminal as management of rendering is being
// moved back to the terminal
this._terminal.refresh(this._bufferService.buffer.y, this._bufferService.buffer.y);
} }
public onCursorMove(): void { public onCursorMove(): void {
@@ -148,12 +148,17 @@ export class CursorRenderLayer extends BaseRenderLayer {
this._clearCursor(); this._clearCursor();
this._ctx.save(); this._ctx.save();
this._ctx.fillStyle = this._colors.cursor.css; this._ctx.fillStyle = this._colors.cursor.css;
this._renderBlurCursor(this._bufferService.buffer.x, viewportRelativeCursorY, this._cell); const cursorStyle = this._optionsService.options.cursorStyle;
if (cursorStyle && cursorStyle !== 'block') {
this._cursorRenderers[cursorStyle](this._bufferService.buffer.x, viewportRelativeCursorY, this._cell);
} else {
this._renderBlurCursor(this._bufferService.buffer.x, viewportRelativeCursorY, this._cell);
}
this._ctx.restore(); this._ctx.restore();
this._state.x = this._bufferService.buffer.x; this._state.x = this._bufferService.buffer.x;
this._state.y = viewportRelativeCursorY; this._state.y = viewportRelativeCursorY;
this._state.isFocused = false; this._state.isFocused = false;
this._state.style = this._optionsService.options.cursorStyle; this._state.style = cursorStyle;
this._state.width = this._cell.getWidth(); this._state.width = this._cell.getWidth();
return; return;
} }
+3 -3
View File
@@ -183,7 +183,7 @@ export class DomRenderer extends Disposable implements IRenderer {
`}`; `}`;
// Cursor // Cursor
styles += styles +=
`${this._terminalSelector} .${ROW_CONTAINER_CLASS}:not(.${FOCUS_CLASS}) .${CURSOR_CLASS} {` + `${this._terminalSelector} .${ROW_CONTAINER_CLASS}:not(.${FOCUS_CLASS}) .${CURSOR_CLASS}.${CURSOR_STYLE_BLOCK_CLASS} {` +
` outline: 1px solid ${this._colors.cursor.css};` + ` outline: 1px solid ${this._colors.cursor.css};` +
` outline-offset: -1px;` + ` outline-offset: -1px;` +
`}` + `}` +
@@ -197,10 +197,10 @@ export class DomRenderer extends Disposable implements IRenderer {
` background-color: ${this._colors.cursor.css};` + ` background-color: ${this._colors.cursor.css};` +
` color: ${this._colors.cursorAccent.css};` + ` color: ${this._colors.cursorAccent.css};` +
`}` + `}` +
`${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${CURSOR_CLASS}.${CURSOR_STYLE_BAR_CLASS} {` + `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${CURSOR_CLASS}.${CURSOR_STYLE_BAR_CLASS} {` +
` box-shadow: 1px 0 0 ${this._colors.cursor.css} inset;` + ` box-shadow: 1px 0 0 ${this._colors.cursor.css} inset;` +
`}` + `}` +
`${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${CURSOR_CLASS}.${CURSOR_STYLE_UNDERLINE_CLASS} {` + `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${CURSOR_CLASS}.${CURSOR_STYLE_UNDERLINE_CLASS} {` +
` box-shadow: 0 -1px 0 ${this._colors.cursor.css} inset;` + ` box-shadow: 0 -1px 0 ${this._colors.cursor.css} inset;` +
`}`; `}`;
// Selection // Selection