移动端滚动按钮支持 tmux 鼠标滚轮

This commit is contained in:
beibeizi committed 2026-03-16 17:04:04 +08:00
1 parent de5df5e98c
commit e85d25199d
1 file changed
+18 -1
@@ -261,8 +261,25 @@ export function useTerminalSocket({
const sequence = delta < 0 ? "\x1b[5~" : "\x1b[6~";
sendInput(sequence);
};
const sendTmuxMouseWheel = (delta: number) => {
if (delta === 0) {
return;
}
const col = Math.max(1, Math.floor(term.cols / 2));
const row = Math.max(1, Math.floor(term.rows / 2));
const code = delta < 0 ? 64 : 65;
sendInput(`\x1b[<${code};${col};${row}M`);
};
if (mode === "remote") {
sendTmuxWheelPage(lineDelta);
if (enhancedSessionRef.current && term.modes.mouseTrackingMode !== "none") {
sendTmuxMouseWheel(lineDelta);
return;
}
if (enhancedSessionRef.current) {
term.scrollLines(lineDelta);
return;
}
term.scrollLines(lineDelta);
return;
}
const activeBuffer = term.buffer.active;