移动端滚动按钮强制触发 tmux 翻页
This commit is contained in:
1 parent
ae83daeff6
commit
de5df5e98c
2 files changed
+7
-3
No files matched your search
@@ -142,7 +142,7 @@ export function TerminalMobile({ state, onBack }: TerminalMobileProps) {
|
||||
<div className="absolute right-4 bottom-4 flex flex-col gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => scrollTerminal("up")}
|
||||
onClick={() => scrollTerminal("up", "remote")}
|
||||
className={`h-10 w-10 rounded-full border text-base ${
|
||||
state.isDark
|
||||
? "border-slate-700 bg-slate-900/90 text-slate-200"
|
||||
@@ -154,7 +154,7 @@ export function TerminalMobile({ state, onBack }: TerminalMobileProps) {
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => scrollTerminal("down")}
|
||||
onClick={() => scrollTerminal("down", "remote")}
|
||||
className={`h-10 w-10 rounded-full border text-base ${
|
||||
state.isDark
|
||||
? "border-slate-700 bg-slate-900/90 text-slate-200"
|
||||
|
||||
@@ -247,7 +247,7 @@ export function useTerminalSocket({
|
||||
const connectSocketRef = React.useRef(connectSocket);
|
||||
const sendInputRef = React.useRef(sendInput);
|
||||
const syncTerminalSizeRef = React.useRef(syncTerminalSize);
|
||||
const scrollTerminal = React.useCallback((direction: "up" | "down") => {
|
||||
const scrollTerminal = React.useCallback((direction: "up" | "down", mode: "auto" | "remote" = "auto") => {
|
||||
const term = terminalInstance.current;
|
||||
const container = terminalRef.current;
|
||||
if (!term || !container) {
|
||||
@@ -261,6 +261,10 @@ export function useTerminalSocket({
|
||||
const sequence = delta < 0 ? "\x1b[5~" : "\x1b[6~";
|
||||
sendInput(sequence);
|
||||
};
|
||||
if (mode === "remote") {
|
||||
sendTmuxWheelPage(lineDelta);
|
||||
return;
|
||||
}
|
||||
const activeBuffer = term.buffer.active;
|
||||
const hasLocalScrollback = activeBuffer.type === "normal" && activeBuffer.baseY > 0;
|
||||
if (!hasLocalScrollback) {
|
||||
|
||||
Reference in new issue
Block a user