дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-08 19:02:17 +02:00
fix(terminal): remove redundant scroll-to-end button (#1849)
Цей коміт міститься в:
1 джерело
4f65f030ce
коміт
3a6c77dce4
4 files changed
+2
-50
No files matched your search
@@ -91,25 +91,6 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.paneActions {
|
||||
position: absolute;
|
||||
right: 14px;
|
||||
bottom: 8px;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s;
|
||||
background: var(--bg-elev, var(--bg-app));
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.pane:hover .paneActions,
|
||||
.pane:focus-within .paneActions,
|
||||
.paneActions:focus-within {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.exited :global(.xterm-cursor-layer),
|
||||
.exited :global(.xterm-cursor) {
|
||||
visibility: hidden;
|
||||
|
||||
@@ -66,7 +66,6 @@ function tabTooltip(tab: TerminalTab, sessions: Parameters<typeof tabTitle>[1]):
|
||||
function TerminalPane({ sessionKey, active, autofocus }: { sessionKey: string; active: boolean; autofocus: boolean }) {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const status = useTerminals((s) => s.sessions[sessionKey]?.status);
|
||||
const follow = useTerminals((s) => s.sessions[sessionKey]?.follow ?? true);
|
||||
|
||||
// Hidden tabs stay unopened. xterm.open() under display:none measures a 0 cell
|
||||
// and the textarea never accepts input, even after the tab is shown.
|
||||
@@ -90,17 +89,7 @@ function TerminalPane({ sessionKey, active, autofocus }: { sessionKey: string; a
|
||||
if (e.target === e.currentTarget) getSession(sessionKey)?.focus();
|
||||
}}
|
||||
onContextMenu={(e) => paneMenu(e, sessionKey)}
|
||||
>
|
||||
<div className={styles.paneActions} role="toolbar" aria-label="Terminal actions">
|
||||
<IconButton
|
||||
icon="arrow-down"
|
||||
iconSize={14}
|
||||
title="Scroll to End"
|
||||
pressed={follow}
|
||||
onClick={() => getSession(sessionKey)?.setFollow(!follow)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,6 @@ export interface SessionSnapshot {
|
||||
commandRunning: boolean;
|
||||
/** Current directory (initial cwd, updated by OSC 7). */
|
||||
cwd: string;
|
||||
/** True while the viewport is pinned to the newest output. */
|
||||
follow: boolean;
|
||||
}
|
||||
|
||||
export interface SessionOptions {
|
||||
@@ -210,7 +208,6 @@ export class TerminalSession {
|
||||
appTitle: null,
|
||||
commandRunning: false,
|
||||
cwd: opts.cwd,
|
||||
follow: true,
|
||||
};
|
||||
this.host = document.createElement("div");
|
||||
this.host.className = "openidea-terminal-host";
|
||||
@@ -285,11 +282,6 @@ export class TerminalSession {
|
||||
const modes = params.map((p) => (Array.isArray(p) ? p[0] : p) ?? 0);
|
||||
return modes.length > 0 && modes.every((m) => MOUSE_MODES.has(m));
|
||||
}),
|
||||
// Track scroll position: follow when the user scrolls back to the bottom.
|
||||
this.term.onScroll(() => {
|
||||
const atBottom = this.isAtBottom();
|
||||
if (atBottom !== this.snapshot.follow) this.update({ follow: atBottom });
|
||||
}),
|
||||
);
|
||||
this.disposables.push(
|
||||
{ dispose: installTerminalPaste(this.host, (text) => this.paste(text), this.clipboardTarget) },
|
||||
@@ -658,16 +650,6 @@ export class TerminalSession {
|
||||
this.term.clear();
|
||||
}
|
||||
|
||||
isAtBottom(): boolean {
|
||||
return this.term.buffer.active.viewportY >= this.term.buffer.active.baseY;
|
||||
}
|
||||
|
||||
/** Sets the follow flag; when turning it on also scrolls to the bottom. */
|
||||
setFollow(follow: boolean) {
|
||||
if (follow) this.term.scrollToBottom();
|
||||
if (follow !== this.snapshot.follow) this.update({ follow });
|
||||
}
|
||||
|
||||
/** Asks xterm to take the caret. Remembered when the textarea does not exist yet. */
|
||||
focus() {
|
||||
if (this.disposed) return;
|
||||
|
||||
@@ -389,7 +389,7 @@ describe("terminalFont", () => {
|
||||
describe("terminal tab titles", () => {
|
||||
const tab: TerminalTab = { id: "t1", name: "Local", customName: null, shell: null, session: "s1", group: "g1" };
|
||||
const snap = (appTitle: string | null, commandRunning = true): Record<string, SessionSnapshot> => ({
|
||||
s1: { status: "running", exitCode: null, title: "zsh", appTitle, commandRunning, cwd: "/p", follow: true },
|
||||
s1: { status: "running", exitCode: null, title: "zsh", appTitle, commandRunning, cwd: "/p" },
|
||||
});
|
||||
|
||||
it("shows the default name at the prompt, whatever title the shell sets", () => {
|
||||
|
||||
Reference in new issue
Заблокувати користувача