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.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
ios: touch the way a phone expects, and fix the bar width loop
RoversX8efdd98561ca
diff --git a/ios/Sources/HostsView.swift b/ios/Sources/HostsView.swiftindex f53702b7..78c8fb34 100644--- a/ios/Sources/HostsView.swift+++ b/ios/Sources/HostsView.swift@@ -38,7 +38,7 @@ struct HostsView: View {}}Section("Development") {- NavigationLink("This Mac (probe sshd on :2299)", value: Host(name: "probe", hostname: "127.0.0.1", port: 2299, user: NSUserName()))+ NavigationLink("This Mac (probe sshd on :2299)", value: Host(name: "probe", hostname: "127.0.0.1", port: 2299, user: probeUserName()))}}.navigationTitle("ThinkTerm")diff --git a/ios/Sources/TerminalInputView.swift b/ios/Sources/TerminalInputView.swiftindex d7a46902..98dfd73b 100644--- a/ios/Sources/TerminalInputView.swift+++ b/ios/Sources/TerminalInputView.swift@@ -5,8 +5,10 @@ import UIKit/// view over the Metal layer that adopts `UITextInput` so the soft/// keyboard, its IMEs (Pinyin, Kana...) and a hardware keyboard all talk/// to it, and whose gestures are the terminal's -- a tap focuses the pane-/// under it, a drag scrolls, a long press opens the pane's menu, a pinch-/// changes the font.+/// under it and raises the keyboard, a one-finger drag scrolls, a+/// two-finger swipe down puts the keyboard away, a long press opens the+/// pane's menu, a pinch changes the font. A phone can tell a tap from a+/// drag, so there is no keyboard button.////// It holds no text of its own beyond the IME's marked (composing)/// string: committed text goes straight to the core, keys go as key@@ -15,31 +17,101 @@ import UIKit/// composing; cancelling sends nothing; a candidate commits once/// (insertText clears the marked text before unmarkText can commit it/// again); backspace inside a composition edits the marked text only.-final class TerminalInputView: UIView, UITextInput, UIGestureRecognizerDelegate {+final class TerminalInputView: UIScrollView, UITextInput, UIGestureRecognizerDelegate, UIScrollViewDelegate {weak var model: TerminalModel?var onMenu: ((CGPoint) -> Void)?private(set) var marked: String?private var markedSelection = NSRange(location: 0, length: 0)- private var panRemainder: CGFloat = 0private var pinchStart: CGFloat = 1+ /// The scroll view is the drag surface: its content is a tall nothing,+ /// the offset's travel is what the terminal scrolls by, in points, and+ /// the view brings iOS's own inertia and deceleration with it. The+ /// offset is parked mid-way and put back there whenever a scroll ends.+ private let runway: CGFloat = 200_000+ private var lastOffset: CGFloat = 0+ private var recentring = false+ /// Stepped mode: finger travel not yet a whole row.+ private var rowRemainder: CGFloat = 0override init(frame: CGRect) {super.init(frame: frame)isUserInteractionEnabled = truebackgroundColor = .clear+ showsVerticalScrollIndicator = false+ showsHorizontalScrollIndicator = false+ bounces = false+ alwaysBounceVertical = false+ isDirectionalLockEnabled = true+ delaysContentTouches = false+ panGestureRecognizer.maximumNumberOfTouches = 1+ delegate = selflet tap = UITapGestureRecognizer(target: self, action: #selector(tapped(_:)))- let pan = UIPanGestureRecognizer(target: self, action: #selector(panned(_:)))let press = UILongPressGestureRecognizer(target: self, action: #selector(pressed(_:)))let pinch = UIPinchGestureRecognizer(target: self, action: #selector(pinched(_:)))- pan.maximumNumberOfTouches = 1+ let hide = UISwipeGestureRecognizer(target: self, action: #selector(swipedDown(_:)))press.minimumPressDuration = 0.45- for g in [tap, pan, press, pinch] as [UIGestureRecognizer] {+ hide.direction = .down+ hide.numberOfTouchesRequired = 2+ for g in [tap, press, pinch, hide] as [UIGestureRecognizer] {g.delegate = selfaddGestureRecognizer(g)}}+ override func layoutSubviews() {+ super.layoutSubviews()+ let size = CGSize(width: bounds.width, height: runway)+ if contentSize != size {+ contentSize = size+ recentre()+ }+ }++ private func recentre() {+ recentring = true+ contentOffset = CGPoint(x: 0, y: runway / 2)+ lastOffset = contentOffset.y+ recentring = false+ }++ // MARK: UIScrollViewDelegate: the drag, with inertia++ func scrollViewDidScroll(_ scrollView: UIScrollView) {+ if recentring { return }+ let y = contentOffset.y+ let delta = y - lastOffset+ lastOffset = y+ guard delta != 0, let model else { return }+ // The bounds' origin is the content offset; the App wants a point+ // in the view, so the centre is measured from the top-left corner.+ let centre = CGPoint(x: bounds.width / 2, y: bounds.height / 2)+ if model.smoothScroll {+ model.wheelPx(at: centre, px: Double(delta))+ } else {+ // Whole rows, at the App's own row height.+ let row = CGFloat(max(model.cellHeight, 1))+ rowRemainder += delta+ let rows = (rowRemainder / row).rounded(.towardZero)+ if rows != 0 {+ rowRemainder -= rows * row+ // The App's stepped mode counts a wheel event as one notch+ // per line asked; the shell scrolls history up by asking+ // for negative lines.+ model.wheel(at: centre, lines: Double(-rows))+ }+ }+ }++ func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {+ if !decelerate { recentre() }+ if !(model?.smoothScroll ?? true) { rowRemainder = 0 }+ }++ func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {+ recentre()+ }+required init?(coder: NSCoder) { fatalError() }// MARK: gestures@@ -54,23 +126,9 @@ final class TerminalInputView: UIView, UITextInput, UIGestureRecognizerDelegate}}- @objc private func panned(_ g: UIPanGestureRecognizer) {- let p = g.location(in: self)- switch g.state {- case .began:- panRemainder = 0- case .changed:- // Points to rows: the App's own cell height is unknown here;- // a row is taken as 20 pt, which is what 11 pt Menlo is.- let dy = g.translation(in: self).y + panRemainder- let rows = (dy / 20).rounded(.towardZero)- panRemainder = dy - rows * 20- g.setTranslation(.zero, in: self)- if rows != 0 {- model?.wheel(at: p, lines: Double(rows))- }- default:- break+ @objc private func swipedDown(_ g: UISwipeGestureRecognizer) {+ if isFirstResponder {+ resignFirstResponder()}}diff --git a/ios/Sources/TerminalModel.swift b/ios/Sources/TerminalModel.swiftindex cc3f34eb..b7d1a8f8 100644--- a/ios/Sources/TerminalModel.swift+++ b/ios/Sources/TerminalModel.swift@@ -28,6 +28,15 @@ final class TerminalModel: ObservableObject, @unchecked Sendable {@Published var stats = ""@Published var inset: CGFloat = 0@Published var animating = false+ /// Smooth (by the pixel, with inertia) or stepped (whole rows).+ @Published var smoothScroll: Bool = UserDefaults.standard.object(forKey: "scroll.smooth") as? Bool ?? true {+ didSet {+ UserDefaults.standard.set(smoothScroll, forKey: "scroll.smooth")+ applyScrollMode()+ }+ }+ /// The App's cell height in points, from its layout view.+ private(set) var cellHeight: Double = 20let core: Corelet host: Host?@@ -51,7 +60,7 @@ final class TerminalModel: ObservableObject, @unchecked Sendable {// a wrapper that points the remote proxy at an isolated HOME.private var probeKeyPath = "/tmp/ttp-ssh/userkey"private var probeRemoteCommand = "/tmp/ttp-ssh/thinkterm-remote cli --prefer-mux proxy"- private var probeUser = NSUserName()+ private var probeUser = probeUserName()init(host: Host?, store: HostStore?) {self.host = host@@ -76,6 +85,7 @@ final class TerminalModel: ObservableObject, @unchecked Sendable {guard let self else { return }self.stats = self.core.stats()}+ applyScrollMode()if args.contains("--autotest") { scheduleAutotest() }if args.contains("--autoconnect") { scheduleAutoconnect() }if args.contains("--imetest") { scheduleImeTest() }@@ -174,6 +184,14 @@ final class TerminalModel: ObservableObject, @unchecked Sendable {core.wheel(x: point.x, y: point.y, lines: lines)}+ func wheelPx(at point: CGPoint, px: Double) {+ core.wheelPx(x: point.x, y: point.y, px: px)+ }++ private func applyScrollMode() {+ core.setSetting(key: "scroll-mode", value: smoothScroll ? "\"smooth\"" : "\"stepped\"")+ }+func stepFont(_ by: Double) { core.stepFont(by: by) }// MARK: the App's chrome@@ -214,6 +232,12 @@ final class TerminalModel: ObservableObject, @unchecked Sendable {sidebar = ViewJSON.decode(SidebarView.self, core.view(name: "sidebar"))navs = ViewJSON.decode([NavView].self, core.view(name: "navs")) ?? []status = ViewJSON.decode(StatusView.self, core.view(name: "status"))+ let layout = core.view(name: "layout")+ if let r = layout.range(of: "\"cell\":["),+ let end = layout[r.upperBound...].firstIndex(of: "]") {+ let parts = layout[r.upperBound..<end].split(separator: ",")+ if parts.count == 2, let h = Double(parts[1]), h > 0 { cellHeight = h }+ }}// MARK: surface lifecycle, all on the main thread@@ -516,6 +540,19 @@ final class TerminalModel: ObservableObject, @unchecked Sendable {private func sizeString() -> String { statsField("size") }}+/// The Mac user the probe's key belongs to: the `user@host` comment+/// ssh-keygen wrote at the end of the public key. The simulator gives an+/// app neither USER nor a real NSUserName.+func probeUserName() -> String {+ if let pub = try? String(contentsOfFile: "/tmp/ttp-ssh/userkey.pub", encoding: .utf8),+ let comment = pub.split(separator: " ").dropFirst(2).first,+ let user = comment.split(separator: "@").first, !user.isEmpty {+ return String(user)+ }+ let env = ProcessInfo.processInfo.environment["USER"] ?? ""+ return env.isEmpty ? NSUserName() : env+}+/// UniFFI hands the callback object to the core thread; it forwards to the/// model without touching anything that needs the main thread.private final class NotifySink: Notify, @unchecked Sendable {diff --git a/ios/Sources/TerminalScreen.swift b/ios/Sources/TerminalScreen.swiftindex 06308fb3..728f3834 100644--- a/ios/Sources/TerminalScreen.swift+++ b/ios/Sources/TerminalScreen.swift@@ -39,6 +39,7 @@ struct TerminalScreen: View {Button("Zoom pane") { model.chromeClick("zoom") }Button("Close pane", role: .destructive) { model.chromeClick("close") }Divider()+ Toggle("Smooth scrolling", isOn: $model.smoothScroll)Button("Paste") { model.pasteFromClipboard() }Button(model.connection.hasPrefix("disconnected") || model.connection.hasPrefix("failed") ? "Reconnect" : "Disconnect") {if model.connection.hasPrefix("disconnected") || model.connection.hasPrefix("failed") {@@ -110,47 +111,57 @@ struct TerminalScreen: View {/// The App leaves rows above each pane for its bar; these draw it,/// where the App says (points, from the terminal's origin).private var navBars: some View {- ForEach(model.navs) { nav in- HStack(spacing: 6) {- ForEach(nav.members) { member in- Button {- model.chromeClick("pane", pane: member.pane)- } label: {- HStack(spacing: 4) {- if member.busy {- ProgressView().controlSize(.mini)- }- Text(member.title.isEmpty ? "shell" : member.title)- .lineLimit(1)- .font(.system(size: 11, weight: member.current ? .semibold : .regular))+ // A GeometryReader takes the terminal's box and never grows with+ // its children: a bar the App sizes to a wider tab (the server's,+ // until this phone's claim lands) must not widen the surface, or+ // the surface, the grid and the bars chase each other forever.+ GeometryReader { geo in+ ForEach(model.navs) { nav in+ navBar(nav, maxWidth: max(geo.size.width - nav.rect.left, 0))+ }+ }+ }++ private func navBar(_ nav: NavView, maxWidth: CGFloat) -> some View {+ HStack(spacing: 6) {+ ForEach(nav.members) { member in+ Button {+ model.chromeClick("pane", pane: member.pane)+ } label: {+ HStack(spacing: 4) {+ if member.busy {+ ProgressView().controlSize(.mini)}- .padding(.horizontal, 6)- .padding(.vertical, 2)- .background(member.current ? Color.white.opacity(nav.focused ? 0.22 : 0.12) : Color.clear)- .clipShape(Capsule())+ Text(member.title.isEmpty ? "shell" : member.title)+ .lineLimit(1)+ .font(.system(size: 11, weight: member.current ? .semibold : .regular))}- .buttonStyle(.plain)- }- Spacer(minLength: 0)- Button { model.chromeClick("new-pane", pane: nav.rect.pane) } label: {- Image(systemName: "plus").font(.system(size: 11))- }- .buttonStyle(.plain)- Button { model.chromeClick("close-pane", pane: nav.rect.pane) } label: {- Image(systemName: "xmark").font(.system(size: 11))+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(member.current ? Color.white.opacity(nav.focused ? 0.22 : 0.12) : Color.clear)+ .clipShape(Capsule())}.buttonStyle(.plain)}- .foregroundColor(nav.focused ? .white : .gray)- .padding(.horizontal, 6)- .frame(width: nav.rect.width, height: nav.rect.height, alignment: .leading)- .background(Color(white: nav.focused ? 0.16 : 0.1))- .contentShape(Rectangle())- .onLongPressGesture {- menu = MenuSheet(kind: "pane", id: String(nav.rect.pane), title: "Pane")+ Spacer(minLength: 0)+ Button { model.chromeClick("new-pane", pane: nav.rect.pane) } label: {+ Image(systemName: "plus").font(.system(size: 11))}- .offset(x: nav.rect.left, y: nav.rect.top)+ .buttonStyle(.plain)+ Button { model.chromeClick("close-pane", pane: nav.rect.pane) } label: {+ Image(systemName: "xmark").font(.system(size: 11))+ }+ .buttonStyle(.plain)+ }+ .foregroundColor(nav.focused ? .white : .gray)+ .padding(.horizontal, 6)+ .frame(width: min(nav.rect.width, maxWidth), height: nav.rect.height, alignment: .leading)+ .background(Color(white: nav.focused ? 0.16 : 0.1))+ .contentShape(Rectangle())+ .onLongPressGesture {+ menu = MenuSheet(kind: "pane", id: String(nav.rect.pane), title: "Pane")}+ .offset(x: nav.rect.left, y: nav.rect.top)}private func paneUnder(_ point: CGPoint) -> Int? {@@ -339,8 +350,6 @@ struct KeyBar: View {key("^L") { model.key("l", ctrl: true) }key("^Z") { model.key("z", ctrl: true) }key("⌫") { model.key("Backspace") }- key("⌨︎") { model.focusKeyboard() }- key("⌨︎✕") { model.dismissKeyboard() }}.padding(.horizontal, 6)}diff --git a/thinkterm-mobile/src/core.rs b/thinkterm-mobile/src/core.rsindex 85c1d27a..abb143a3 100644--- a/thinkterm-mobile/src/core.rs+++ b/thinkterm-mobile/src/core.rs@@ -24,7 +24,6 @@ use std::time::{Duration, Instant};use thinkterm_font_core::FontShaper as _;use thinkterm_font_web::{Face, FontSet};use thinkterm_render::pipeline::GpuTexture;-use thinkterm_render::vertex::{Vertex, IS_SOLID_COLOR};use thinkterm_web::app::{build_session, grid_for, App, PaneCell, Setup};use thinkterm_web::attach::{attach, Attached};use thinkterm_web::glyphs::GlyphCache;@@ -126,7 +125,16 @@ pub enum Cmd {y: f64,lines: f64,},+ WheelPx {+ x: f64,+ y: f64,+ px: f64,+ },StepFont(f64),+ SetSetting {+ key: String,+ value: String,+ },}/// The surface currently lent, if any.@@ -171,7 +179,6 @@ struct State {adapter: Option<wgpu::Adapter>,/// The GPU state until the App takes it over.gpu: Option<Gpu>,- white: Option<Rc<GpuTexture>>,app: Option<Rc<MobileApp>>,target: Option<Target>,next_generation: u64,@@ -187,6 +194,8 @@ struct State {conn: Conn,status: String,composing: bool,+ /// The shell's preferences, applied to each App as it is made.+ settings: Vec<(String, String)>,}pub fn run(cmd_tx: Sender<Cmd>, rx: Receiver<Cmd>, notify: Box<dyn Notify>) {@@ -205,7 +214,6 @@ pub fn run(cmd_tx: Sender<Cmd>, rx: Receiver<Cmd>, notify: Box<dyn Notify>) {instance,adapter: None,gpu: None,- white: None,app: None,target: None,next_generation: 1,@@ -221,6 +229,7 @@ pub fn run(cmd_tx: Sender<Cmd>, rx: Receiver<Cmd>, notify: Box<dyn Notify>) {conn: Conn::Idle,status: String::new(),composing: false,+ settings: Vec::new(),};state.notify.on_log("core thread up".into());state.set_status("idle");@@ -457,11 +466,32 @@ impl State {});}}+ Cmd::WheelPx { x, y, px } => {+ if let Some(app) = self.app.clone() {+ app.wheel(&WheelInput {+ x,+ y,+ delta: WheelDelta::Pixels(px),+ mods: KeyModifiers::NONE,+ ctrl: false,+ trusted: true,+ });+ }+ }Cmd::StepFont(by) => {if let Some(app) = self.app.clone() {app.step_font(by);}}+ Cmd::SetSetting { key, value } => {+ self.settings.retain(|(k, _)| k != &key);+ self.settings.push((key.clone(), value.clone()));+ if let Some(app) = self.app.clone() {+ if let Err(err) = app.set_setting(&key, &value) {+ self.notify.on_log(format!("setting {key}: {err}"));+ }+ }+ }}}@@ -561,7 +591,6 @@ impl State {// state; the shell's next attach makes a fresh one.drop(app);self.gpu = None;- self.white = None;self.target = None;self.notify.on_log("the App was still in use; its GPU state went with it -- attach the surface again".into(),@@ -780,6 +809,11 @@ impl State {app.set_on_change(Rc::new(move || notify.on_change()));}app.composing(self.composing);+ for (key, value) in &self.settings {+ if let Err(err) = app.set_setting(key, value) {+ self.notify.on_log(format!("setting {key}: {err}"));+ }+ }app.fetch_tree();app.hide_status();app.refresh_layout();@@ -827,7 +861,6 @@ impl State {height,))?;let info = gpu.adapter_info.name.clone();- self.white = Some(Rc::new(white_texture(&gpu)?));self.gpu = Some(gpu);self.notify.on_log(format!("gpu ready: {info}"));}@@ -948,20 +981,13 @@ impl State {}return;}- // No App yet: the demo, so the surface path can be seen working.+ // No App yet: a bare ground, so the surface path can be seen+ // working without drawing anything that looks like content.self.platform.run_frame();- let (Some(target), Some(gpu), Some(white)) =- (self.target.as_ref(), self.gpu.as_mut(), self.white.as_ref())- else {+ let (Some(_), Some(gpu)) = (self.target.as_ref(), self.gpu.as_mut()) else {return;};- let vertices = demo_scene(- target.width as f32,- target.height as f32,- target.scale as f32,- self.stats.phase,- );- if let Err(err) = gpu.draw_batches(&[(&vertices, white)], [0.07, 0.07, 0.09, 1.0], 0) {+ if let Err(err) = gpu.draw_batches(&[], [0.07, 0.07, 0.09, 1.0], 0) {self.fail(format!("render: {err:#}"));return;}@@ -1015,133 +1041,3 @@ fn json<T: serde::Serialize>(value: &T) -> String {.unwrap_or_else(|err| format!("{{\"error\":{:?}}}", err.to_string()))}-fn white_texture(gpu: &Gpu) -> Result<GpuTexture> {- let white = GpuTexture::new(&gpu.device, Arc::clone(&gpu.queue), 1, 1)?;- gpu.queue.write_texture(- wgpu::TexelCopyTextureInfo {- texture: white.texture(),- mip_level: 0,- origin: wgpu::Origin3d::ZERO,- aspect: wgpu::TextureAspect::All,- },- &[255, 255, 255, 255],- wgpu::TexelCopyBufferLayout {- offset: 0,- bytes_per_row: Some(4),- rows_per_image: Some(1),- },- wgpu::Extent3d {- width: 1,- height: 1,- depth_or_array_layers: 1,- },- );- Ok(white)-}--/// A grid of coloured cells the size a terminal's would be, one of them-/// walking across with the phase, and a bar along the bottom whose length-/// follows the width. Enough to see, in a screenshot, that the projection,-/// the scale and a resize all land where they should.-fn demo_scene(width: f32, height: f32, scale: f32, phase: u64) -> Vec<Vertex> {- let mut out = Vec::new();- let cell_w = 9.0 * scale;- let cell_h = 20.0 * scale;- let cols = ((width - 2.0 * cell_w) / cell_w).floor().max(1.0) as u64;- let rows = ((height - 4.0 * cell_h) / cell_h).floor().max(1.0) as u64;- let x0 = cell_w;- let y0 = cell_h * 2.0;- for row in 0..rows {- for col in 0..cols {- let i = row * cols + col;- let lit = (i + phase) % 7 == 0;- let color = if lit {- let hue = ((i * 37 + phase * 5) % 360) as f32;- hsl(hue, 0.7, 0.55)- } else {- [0.16, 0.16, 0.20, 1.0]- };- push_rect(- &mut out,- width,- height,- x0 + col as f32 * cell_w,- y0 + row as f32 * cell_h,- cell_w - 1.0 * scale,- cell_h - 1.0 * scale,- color,- );- }- }- let walker = (phase % cols.max(1)) as f32;- push_rect(- &mut out,- width,- height,- x0 + walker * cell_w,- cell_h * 0.5,- cell_w,- cell_h,- [1.0, 0.85, 0.2, 1.0],- );- push_rect(- &mut out,- width,- height,- x0,- height - cell_h * 1.5,- width - 2.0 * x0,- cell_h * 0.5,- [0.3, 0.7, 1.0, 1.0],- );- out-}--#[allow(clippy::too_many_arguments)]-fn push_rect(- out: &mut Vec<Vertex>,- width: f32,- height: f32,- x: f32,- y: f32,- w: f32,- h: f32,- color: [f32; 4],-) {- // The projection is centred: pixel (0,0) is at (-width/2, -height/2).- let left = x - width / 2.0;- let top = y - height / 2.0;- let right = left + w;- let bottom = top + h;- let vertex = |px: f32, py: f32| Vertex {- position: [px, py],- tex: [0.0, 0.0],- fg_color: color,- alt_color: color,- hsv: [1.0, 1.0, 1.0],- has_color: IS_SOLID_COLOR,- mix_value: 0.0,- };- // Order matches thinkterm_render::vertex::{V_TOP_LEFT, V_TOP_RIGHT,- // V_BOT_LEFT, V_BOT_RIGHT}, which quad_indices assumes.- out.push(vertex(left, top));- out.push(vertex(right, top));- out.push(vertex(left, bottom));- out.push(vertex(right, bottom));-}--fn hsl(h: f32, s: f32, l: f32) -> [f32; 4] {- let c = (1.0 - (2.0 * l - 1.0).abs()) * s;- let hp = h / 60.0;- let x = c * (1.0 - ((hp % 2.0) - 1.0).abs());- let (r, g, b) = match hp as u32 {- 0 => (c, x, 0.0),- 1 => (x, c, 0.0),- 2 => (0.0, c, x),- 3 => (0.0, x, c),- 4 => (x, 0.0, c),- _ => (c, 0.0, x),- };- let m = l - c / 2.0;- [r + m, g + m, b + m, 1.0]-}diff --git a/thinkterm-mobile/src/lib.rs b/thinkterm-mobile/src/lib.rsindex ddc67a66..35d1c8f8 100644--- a/thinkterm-mobile/src/lib.rs+++ b/thinkterm-mobile/src/lib.rs@@ -286,6 +286,19 @@ impl Core {let _ = self.tx.send(core::Cmd::Wheel { x, y, lines });}+ /// Scroll at a point by `px` points of finger travel; positive is down+ /// the page, towards the newest row. The App keeps the fraction of a+ /// row, so this is what a drag with inertia sends.+ pub fn wheel_px(&self, x: f64, y: f64, px: f64) {+ let _ = self.tx.send(core::Cmd::WheelPx { x, y, px });+ }++ /// One of the App's preferences, as JSON: `set_setting("scroll-mode",+ /// "\"stepped\"")`. Kept by the core and applied to every App it makes.+ pub fn set_setting(&self, key: String, value: String) {+ let _ = self.tx.send(core::Cmd::SetSetting { key, value });+ }+/// Scale the focused pane's font by a tenth per step; 0 resets.pub fn step_font(&self, by: f64) {let _ = self.tx.send(core::Cmd::StepFont(by));diff --git a/thinkterm-web/src/app.rs b/thinkterm-web/src/app.rsindex 08ed6fa9..5eb8555c 100644--- a/thinkterm-web/src/app.rs+++ b/thinkterm-web/src/app.rs@@ -2155,6 +2155,9 @@ impl<P: Platform, L: Link> App<P, L> {/// The bar above each pane, in CSS px.fn nav_css(inner: &Inner<P, L>) -> f64 {+ if inner.platform.is_mobile() {+ return crate::navbar::MOBILE_NAV_CSS;+ }let cell_css = inner.glyphs.metrics.cell_size.height as f64 / inner.dpr.max(0.1);crate::navbar::nav_css(cell_css, Self::desktop_cell_css(inner))}diff --git a/thinkterm-web/src/navbar.rs b/thinkterm-web/src/navbar.rsindex a78db93b..4a3785e5 100644--- a/thinkterm-web/src/navbar.rs+++ b/thinkterm-web/src/navbar.rs@@ -11,6 +11,12 @@ use crate::layout::{PanePlacement, TabLayout};/// a 46.67 px cell, the smallest count a 94 px bar needs).pub const DESKTOP_NAV_CSS: f64 = 47.0;+/// The bar on a phone, in points: room for one row of 11 pt capsules.+/// The desktop's 47 is a third of a phone's terminal at a large font,+/// and the grid pays for it in whole rows, so it came to four rows+/// (65 pt) at 11 pt -- a bar taller than the tab strip above it.+pub const MOBILE_NAV_CSS: f64 = 28.0;+/// The bar's height on this page. The desktop's, scaled by how far the/// page's cell is from the desktop's: with the font matched the ratio/// is one and the bar is the desktop's to the pixel.