update at 2026-03-04 13:25:26
This commit is contained in:
@@ -186,6 +186,8 @@ let asciiFallbackTimer: number | null = null;
|
||||
let asciiFallbackText = "";
|
||||
let compositionGuardTimer: number | null = null;
|
||||
let compositionStartedAt = 0;
|
||||
let cursorBlinkTimer: number | null = null;
|
||||
let isCursorVisible = true;
|
||||
let lastKeyboardCommittedText = "";
|
||||
let lastKeyboardCommittedAt = 0;
|
||||
let keyboardAssistBridgeText = "";
|
||||
@@ -1224,6 +1226,7 @@ function initTerminal(): void {
|
||||
* 触屏端依赖 iOS 自身动量;桌面端保留平滑滚动。
|
||||
*/
|
||||
smoothScrollDuration: nativeTouchSelectionEnabled ? 0 : TERMINAL_SMOOTH_SCROLL_DURATION_MS,
|
||||
cursorBlink: false,
|
||||
theme: {
|
||||
background: settingsStore.settings.shellBgColor,
|
||||
foreground: settingsStore.settings.shellTextColor,
|
||||
@@ -1249,6 +1252,25 @@ function initTerminal(): void {
|
||||
|
||||
terminal.open(containerRef.value);
|
||||
|
||||
terminal.onKey(({ domEvent }) => {
|
||||
if (domEvent.key === "Enter" && terminal) {
|
||||
terminal.scrollToBottom();
|
||||
}
|
||||
});
|
||||
|
||||
if (cursorBlinkTimer !== null) {
|
||||
window.clearInterval(cursorBlinkTimer);
|
||||
}
|
||||
isCursorVisible = true;
|
||||
cursorBlinkTimer = window.setInterval(() => {
|
||||
if (!terminal) return;
|
||||
isCursorVisible = !isCursorVisible;
|
||||
terminal.options.theme = {
|
||||
...terminal.options.theme,
|
||||
cursor: isCursorVisible ? settingsStore.settings.shellAccentColor : "rgba(0,0,0,0)"
|
||||
};
|
||||
}, 1800);
|
||||
|
||||
terminal.attachCustomKeyEventHandler((event) => {
|
||||
if (isCopyShortcut(event) && terminal?.hasSelection()) {
|
||||
const selected = terminal.getSelection();
|
||||
@@ -2002,6 +2024,10 @@ watch(
|
||||
);
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (cursorBlinkTimer !== null) {
|
||||
window.clearInterval(cursorBlinkTimer);
|
||||
cursorBlinkTimer = null;
|
||||
}
|
||||
window.removeEventListener("resize", handleResize);
|
||||
resizeObserver?.disconnect();
|
||||
resizeObserver = null;
|
||||
|
||||
@@ -1367,6 +1367,14 @@ select.input {
|
||||
-webkit-touch-callout: default;
|
||||
}
|
||||
|
||||
/* 规避 iOS 触摸事件吞噬问题:
|
||||
当目标是 span 等特定内联元素时,iOS 容易在滑动中没收 touchmove。
|
||||
将其鼠标事件穿透到 div (行) 上可以绕过引发吞没的 WebKit 内核特定文本触摸启发式逻辑
|
||||
同时并不影响基于坐标的文本选择。 */
|
||||
.terminal-container.native-touch-selection .xterm-screen span {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 移动端字体渲染优化 */
|
||||
@media (pointer: coarse) {
|
||||
.terminal-container .xterm {
|
||||
|
||||
Reference in New Issue
Block a user