Skip to content

Commit

Permalink
Add option for blinking cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
sedwards2009 committed May 3, 2024
1 parent 62c14f1 commit 402c09b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions main/src/Window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ export class Window implements Disposable {
if (!(oldConfig.terminalFont === newConfig.terminalFont &&
oldConfig.terminalFontSize === newConfig.terminalFontSize &&
oldConfig.cursorStyle === newConfig.cursorStyle &&
oldConfig.blinkingCursor === newConfig.blinkingCursor &&
oldConfig.themeTerminal === newConfig.themeTerminal &&
oldConfig.terminalDisplayLigatures === newConfig.terminalDisplayLigatures &&
oldConfig.terminalMarginStyle === newConfig.terminalMarginStyle)) {
Expand Down
1 change: 1 addition & 0 deletions main/src/emulator/TextTerm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ export class TextEmulator implements TextEmulatorApi {
this.#send('\x1b[O');
}
this.#hasFocus = false;
this.#cursorBlinkState = true;
this.#scheduleCursorRefresh();
}

Expand Down
9 changes: 9 additions & 0 deletions main/src/settings/AppearancePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,15 @@ export class AppearancePage implements SettingsPageType {
}),
),

"",
CheckBox({
text: "Blink",
checkState: generalConfig.blinkingCursor,
onStateChanged: (state: number) => {
update((c) => c.blinkingCursor = Boolean(state));
}
}),

"Margin:",
shrinkWrap(ComboBox({
currentIndex: marginSizes.indexOf(generalConfig.terminalMarginStyle),
Expand Down
11 changes: 8 additions & 3 deletions main/src/terminal/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,10 @@ export class Terminal implements Tab, Disposable {
}
`, false);

if (this.#emulator != null) {
this.#emulator.setCursorBlink(terminalVisualConfig.cursorBlink);
}

this.resizeTerminalArea();
}

Expand Down Expand Up @@ -1098,9 +1102,10 @@ export class Terminal implements Tab, Disposable {
});

emulator.onWriteBufferSize(this.#handleWriteBufferSize.bind(this));
// if (this._terminalVisualConfig != null) {
// emulator.setCursorBlink(this._terminalVisualConfig.cursorBlink);
// }

if (this.#terminalVisualConfig != null) {
emulator.setCursorBlink(this.#terminalVisualConfig.cursorBlink);
}

this.#enforceScrollbackSizeLater = new DebouncedDoLater(() => {
this.#laterEnforceScrollbackSize();
Expand Down

0 comments on commit 402c09b

Please sign in to comment.