mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Allow the thickness of the bar cursor to be configured
This commit is contained in:
@@ -153,11 +153,11 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
||||
* @param x The column to fill.
|
||||
* @param y The row to fill.
|
||||
*/
|
||||
protected _fillLeftLineAtCell(x: number, y: number): void {
|
||||
protected _fillLeftLineAtCell(x: number, y: number, width: number = 1): void {
|
||||
this._ctx.fillRect(
|
||||
x * this._scaledCellWidth,
|
||||
y * this._scaledCellHeight,
|
||||
window.devicePixelRatio,
|
||||
window.devicePixelRatio * width,
|
||||
this._scaledCellHeight);
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
||||
private _renderBarCursor(terminal: Terminal, x: number, y: number, cell: ICellData): void {
|
||||
this._ctx.save();
|
||||
this._ctx.fillStyle = this._colors.cursor.css;
|
||||
this._fillLeftLineAtCell(x, y);
|
||||
this._fillLeftLineAtCell(x, y, terminal.getOption('cursorBarWidth'));
|
||||
this._ctx.restore();
|
||||
}
|
||||
|
||||
|
||||
@@ -171,11 +171,11 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
||||
* @param x The column to fill.
|
||||
* @param y The row to fill.
|
||||
*/
|
||||
protected _fillLeftLineAtCell(x: number, y: number): void {
|
||||
protected _fillLeftLineAtCell(x: number, y: number, width: number = 1): void {
|
||||
this._ctx.fillRect(
|
||||
x * this._scaledCellWidth,
|
||||
y * this._scaledCellHeight,
|
||||
window.devicePixelRatio,
|
||||
window.devicePixelRatio * width,
|
||||
this._scaledCellHeight);
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
||||
private _renderBarCursor(x: number, y: number, cell: ICellData): void {
|
||||
this._ctx.save();
|
||||
this._ctx.fillStyle = this._colors.cursor.css;
|
||||
this._fillLeftLineAtCell(x, y);
|
||||
this._fillLeftLineAtCell(x, y, this._optionsService.options.cursorBarWidth);
|
||||
this._ctx.restore();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({
|
||||
rows: 24,
|
||||
cursorBlink: false,
|
||||
cursorStyle: 'block',
|
||||
cursorBarWidth: 1,
|
||||
bellSound: DEFAULT_BELL_SOUND,
|
||||
bellStyle: 'none',
|
||||
drawBoldTextInBrightColors: true,
|
||||
|
||||
@@ -191,6 +191,7 @@ export interface IPartialTerminalOptions {
|
||||
cols?: number;
|
||||
cursorBlink?: boolean;
|
||||
cursorStyle?: 'block' | 'underline' | 'bar';
|
||||
cursorBarWidth?: number;
|
||||
disableStdin?: boolean;
|
||||
drawBoldTextInBrightColors?: boolean;
|
||||
fastScrollModifier?: 'alt' | 'ctrl' | 'shift';
|
||||
@@ -223,6 +224,7 @@ export interface ITerminalOptions {
|
||||
cols: number;
|
||||
cursorBlink: boolean;
|
||||
cursorStyle: 'block' | 'underline' | 'bar';
|
||||
cursorBarWidth: number;
|
||||
disableStdin: boolean;
|
||||
drawBoldTextInBrightColors: boolean;
|
||||
fastScrollModifier: 'alt' | 'ctrl' | 'shift' | undefined;
|
||||
|
||||
Vendored
+5
@@ -72,6 +72,11 @@ declare module 'xterm' {
|
||||
*/
|
||||
cursorStyle?: 'block' | 'underline' | 'bar';
|
||||
|
||||
/**
|
||||
* The width of the bar cursor.
|
||||
*/
|
||||
cursorBarWidth?: number;
|
||||
|
||||
/**
|
||||
* Whether input should be disabled.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user