mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
* feat(terminal): Add configurable terminal bar cursor width Adds a configurable bar-cursor width for the terminal so thin vertical cursors are easier to find, particularly when vi/vim switches to insert mode. * Add terminal bar cursor width setting This adds the terminal bar cursor width control to the settings UI with an aria-label for accessibility and a matching test. It also adds localized labels/descriptions and search catalog entries so the setting is discoverable in both English and Chinese. * Fix terminal cursor width override bug Prevent width-only cursor updates from clearing DEC/vi cursor overrides by tracking the last applied shape/blink snapshot. The runtime now resets the snapshot on teardown, skips full cursor reapplication for width-only changes, and preserves remote bar/underline cursor styles. Added regression tests covering boot-time and later width updates. * Fix terminal cursor preference lifecycle Preserve DEC/vi cursor overrides during the first width-only terminal update after runtime creation. The runtime now records the user cursor preference snapshot when a term is published and applies width-only updates without clearing active cursor style or blink overrides. This prevents regressions when terminal settings change before the panel has fully booted. --------- Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
53 lines
2.5 KiB
TypeScript
53 lines
2.5 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
const source = readFileSync(new URL("./SettingsTerminalTab.tsx", import.meta.url), "utf8");
|
|
|
|
test("terminal settings expose cursor line highlight toggle", () => {
|
|
assert.match(source, /settings\.terminal\.cursor\.highlightLine/);
|
|
assert.match(source, /checked=\{terminalSettings\.highlightCursorLine\}/);
|
|
assert.match(source, /updateTerminalSetting\("highlightCursorLine", v\)/);
|
|
});
|
|
|
|
test("terminal settings expose a bounded bar cursor width control", () => {
|
|
assert.match(source, /settings\.terminal\.cursor\.barWidth/);
|
|
assert.match(source, /min=\{1\}/);
|
|
assert.match(source, /max=\{4\}/);
|
|
assert.match(source, /value=\{terminalSettings\.cursorBarWidth\}/);
|
|
assert.match(source, /aria-label=\{t\("settings\.terminal\.cursor\.barWidth"\)\}/);
|
|
assert.match(source, /updateTerminalSetting\("cursorBarWidth", parseInt\(e\.target\.value\)\)/);
|
|
});
|
|
|
|
test("terminal settings hide terminal theme pickers while following app theme", () => {
|
|
assert.match(source, /\{!followAppTerminalTheme && \(/);
|
|
assert.doesNotMatch(source, /settings\.terminal\.theme\.followingTheme/);
|
|
});
|
|
|
|
test("terminal settings only update the legacy global theme for the active mode", () => {
|
|
assert.match(source, /if \(themeModalSlot === resolvedTheme\) \{\s*setTerminalThemeId\(id\);/);
|
|
});
|
|
|
|
test("terminal settings expose host key verification toggle", () => {
|
|
assert.match(source, /settings\.terminal\.connection\.verifyHostKeys/);
|
|
assert.match(source, /checked=\{terminalSettings\.verifyHostKeys\}/);
|
|
assert.match(source, /updateTerminalSetting\("verifyHostKeys", v\)/);
|
|
});
|
|
|
|
test("terminal settings expose SSH auto reconnect toggle", () => {
|
|
assert.match(source, /settings\.terminal\.connection\.sshAutoReconnectEnabled/);
|
|
assert.match(source, /checked=\{terminalSettings\.sshAutoReconnectEnabled\}/);
|
|
assert.match(source, /updateTerminalSetting\("sshAutoReconnectEnabled", v\)/);
|
|
});
|
|
|
|
test("terminal settings expose the host information bar toggle", () => {
|
|
assert.match(source, /checked=\{terminalSettings\.showHostInfoBar\}/);
|
|
assert.match(source, /updateTerminalSetting\("showHostInfoBar", v\)/);
|
|
});
|
|
|
|
test("terminal settings expose host information title mode when the bar is shown", () => {
|
|
assert.match(source, /terminalSettings\.showHostInfoBar && \(/);
|
|
assert.match(source, /updateTerminalSetting\("hostInfoBarTitleMode"/);
|
|
assert.match(source, /settings\.terminal\.hostInfoBar\.titleMode/);
|
|
});
|