Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

fix(terminal): remove redundant scroll-to-end button (#1849)

l0ng-ai3a6c77dce4a5
diff --git a/src/features/terminal/Terminal.module.css b/src/features/terminal/Terminal.module.css
index 7e69d829c..acc77a358 100644
--- a/src/features/terminal/Terminal.module.css
+++ b/src/features/terminal/Terminal.module.css
@@ -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;
diff --git a/src/features/terminal/TerminalView.tsx b/src/features/terminal/TerminalView.tsx
index 441aa202c..efc1964cb 100644
--- a/src/features/terminal/TerminalView.tsx
+++ b/src/features/terminal/TerminalView.tsx
@@ -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>
+ />
);
}
diff --git a/src/features/terminal/session.ts b/src/features/terminal/session.ts
index de673fb2c..af0f806ef 100644
--- a/src/features/terminal/session.ts
+++ b/src/features/terminal/session.ts
@@ -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;
diff --git a/src/features/terminal/terminal.test.ts b/src/features/terminal/terminal.test.ts
index f6b1a7dfc..7bd17738b 100644
--- a/src/features/terminal/terminal.test.ts
+++ b/src/features/terminal/terminal.test.ts
@@ -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", () => {