Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

mobile: the overview keeps the terminal's newest rows

RoversX9c75301399c3
diff --git a/android/app/src/main/java/com/roversx/thinkterm/TerminalScreen.kt b/android/app/src/main/java/com/roversx/thinkterm/TerminalScreen.kt
index cc6b7e06..5b44d88f 100644
--- a/android/app/src/main/java/com/roversx/thinkterm/TerminalScreen.kt
+++ b/android/app/src/main/java/com/roversx/thinkterm/TerminalScreen.kt
@@ -241,8 +241,9 @@ fun TerminalScreen(host: Host, store: HostStore, onBack: () -> Unit) {
Spacer(Modifier.height(if (twoLevel) 80.dp else 48.dp))
}
- // The terminal, scaled and moved into the card and clipped to
- // its height as the zoom goes from 0 to 1.
+ // The terminal, scaled to the card's width and moved into it as
+ // the zoom goes from 0 to 1; the card keeps the bottom of it,
+ // the newest rows, as the other cards' previews do.
Box(
Modifier
.fillMaxWidth()
@@ -255,10 +256,14 @@ fun TerminalScreen(host: Host, store: HostStore, onBack: () -> Unit) {
if (target != null && terminalBounds.width > 0) {
val s = target.width / terminalBounds.width
val scale = 1f + (s - 1f) * t
+ val top = (terminalBounds.height - target.height / s) * t
scaleX = scale
scaleY = scale
translationX = (target.left - terminalBounds.left) * t
- translationY = (target.top - terminalBounds.top) * t
+ translationY = (target.top - terminalBounds.top) * t - top * scale
+ // The card's own corners, once the terminal is in it.
+ val r = 13.dp.toPx() / scale * t
+ shape = RoundedCornerShape(bottomStart = r, bottomEnd = r)
} else {
scaleX = 1f
scaleY = 1f
@@ -272,10 +277,8 @@ fun TerminalScreen(host: Host, store: HostStore, onBack: () -> Unit) {
val target = zoomTarget
if (target != null && terminalBounds.width > 0) {
val s = target.width / terminalBounds.width
- val full = size.height
- val clipped = target.height / s
- val h = full + (clipped - full) * zoom.value
- clipRect(bottom = h) { [email protected]() }
+ val top = (size.height - target.height / s) * zoom.value
+ clipRect(top = top) { [email protected]() }
} else {
drawContent()
}
diff --git a/ios/Sources/TerminalScreen.swift b/ios/Sources/TerminalScreen.swift
index fecf1d50..95e02ebc 100644
--- a/ios/Sources/TerminalScreen.swift
+++ b/ios/Sources/TerminalScreen.swift
@@ -56,8 +56,10 @@ struct TerminalScreen: View {
.onAppear { terminalFrame = geo.frame(in: .named("screen")) }
.onChange(of: geo.frame(in: .named("screen"))) { _, f in terminalFrame = f }
})
- .mask(alignment: .top) {
- Rectangle().frame(height: zoomClip)
+ .mask(alignment: .bottom) {
+ // The card's own corners, once the terminal is in it.
+ UnevenRoundedRectangle(bottomLeadingRadius: 13 / zoomScale, bottomTrailingRadius: 13 / zoomScale)
+ .frame(height: zoomClip)
}
.scaleEffect(zoomScale, anchor: .topLeading)
.offset(zoomOffset)
@@ -339,15 +341,20 @@ struct TerminalScreen: View {
}
/// Shrink the terminal into the card's thumbnail: scaled to its
- /// width, moved to its corner, and masked to its height.
+ /// width, moved into it, and masked to its height from the bottom,
+ /// so the card keeps the newest rows as the other cards' previews do.
private func zoom(into frame: CGRect) {
guard terminalFrame.width > 0 else { return }
let scale = frame.width / terminalFrame.width
+ let clip = frame.height / scale
withAnimation(.spring(response: 0.4, dampingFraction: 0.85)) {
overviewOpen = true
zoomScale = scale
- zoomOffset = CGSize(width: frame.minX - terminalFrame.minX, height: frame.minY - terminalFrame.minY)
- zoomClip = frame.height / scale
+ zoomOffset = CGSize(
+ width: frame.minX - terminalFrame.minX,
+ height: frame.minY - terminalFrame.minY - (terminalFrame.height - clip) * scale
+ )
+ zoomClip = clip
}
}