mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
add showCursorImmediately option
This commit is contained in:
@@ -18,6 +18,19 @@ describe('CoreService', () => {
|
||||
new MockOptionsService());
|
||||
});
|
||||
|
||||
describe('isCursorInitialized', () => {
|
||||
it('should be false by default', () => {
|
||||
assert.equal(coreService.isCursorInitialized, false);
|
||||
});
|
||||
it('should be true when showCursorImmediately is true', () => {
|
||||
const coreServiceWithOption = new CoreService(
|
||||
new MockBufferService(80, 30),
|
||||
new MockLogService(),
|
||||
new MockOptionsService({ showCursorImmediately: true }));
|
||||
assert.equal(coreServiceWithOption.isCursorInitialized, true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('reset', () => {
|
||||
it('should not affect isCursorInitialized', () => {
|
||||
coreService.isCursorInitialized = true;
|
||||
|
||||
@@ -38,7 +38,7 @@ const DEFAULT_KITTY_KEYBOARD_STATE = (): IKittyKeyboardState => ({
|
||||
export class CoreService extends Disposable implements ICoreService {
|
||||
public serviceBrand: any;
|
||||
|
||||
public isCursorInitialized: boolean = false;
|
||||
public isCursorInitialized: boolean;
|
||||
public isCursorHidden: boolean = false;
|
||||
public modes: IModes;
|
||||
public decPrivateModes: IDecPrivateModes;
|
||||
@@ -59,6 +59,7 @@ export class CoreService extends Disposable implements ICoreService {
|
||||
@IOptionsService private readonly _optionsService: IOptionsService
|
||||
) {
|
||||
super();
|
||||
this.isCursorInitialized = _optionsService.rawOptions.showCursorImmediately ?? false;
|
||||
this.modes = clone(DEFAULT_MODES);
|
||||
this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);
|
||||
this.kittyKeyboard = DEFAULT_KITTY_KEYBOARD_STATE();
|
||||
|
||||
@@ -12,6 +12,7 @@ import { Emitter } from 'vs/base/common/event';
|
||||
export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
||||
cols: 80,
|
||||
rows: 24,
|
||||
showCursorImmediately: false,
|
||||
cursorBlink: false,
|
||||
cursorStyle: 'block',
|
||||
cursorWidth: 1,
|
||||
|
||||
@@ -253,6 +253,7 @@ export interface ITerminalOptions {
|
||||
rescaleOverlappingGlyphs?: boolean;
|
||||
rightClickSelectsWord?: boolean;
|
||||
rows?: number;
|
||||
showCursorImmediately?: boolean;
|
||||
screenReaderMode?: boolean;
|
||||
scrollback?: number;
|
||||
scrollOnUserInput?: boolean;
|
||||
|
||||
Vendored
+7
@@ -252,6 +252,13 @@ declare module '@xterm/headless' {
|
||||
* The number of rows in the terminal.
|
||||
*/
|
||||
rows?: number;
|
||||
|
||||
/**
|
||||
* Whether to show the cursor immediately when the terminal is created.
|
||||
* When false (default), the cursor will not be visible until the terminal
|
||||
* is focused for the first time.
|
||||
*/
|
||||
showCursorImmediately?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+7
@@ -340,6 +340,13 @@ declare module '@xterm/xterm' {
|
||||
* The number of rows in the terminal.
|
||||
*/
|
||||
rows?: number;
|
||||
|
||||
/**
|
||||
* Whether to show the cursor immediately when the terminal is created.
|
||||
* When false (default), the cursor will not be visible until the terminal
|
||||
* is focused for the first time.
|
||||
*/
|
||||
showCursorImmediately?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user