add showCursorImmediately option

This commit is contained in:
meganrogge
2026-01-13 10:36:35 -06:00
parent d28046ebed
commit a20ff565b0
6 changed files with 31 additions and 1 deletions
+13
View File
@@ -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;
+2 -1
View File
@@ -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();
+1
View File
@@ -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,
+1
View File
@@ -253,6 +253,7 @@ export interface ITerminalOptions {
rescaleOverlappingGlyphs?: boolean;
rightClickSelectsWord?: boolean;
rows?: number;
showCursorImmediately?: boolean;
screenReaderMode?: boolean;
scrollback?: number;
scrollOnUserInput?: boolean;
+7
View File
@@ -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;
}
/**
+7
View File
@@ -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;
}
/**