╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────╮ │12 const Grid = xitui.grid.Grid; │ │13 const Focus = xitui.focus.Focus; │ │14 const evt = @import("./event.zig"); │ │15 +const inp = @import("./ui/input.zig"); │ │16 │ │17 pub const Home = @import("./ui/Home.zig");│ │18 pub const User = @import("./ui/User.zig");│ ╰──────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │968 // port the web UI is served on, for the TUI/SSH footer's "http://localhost:<port>..."│ │969 // url. null on the web itself (no footer there). │ │970 web_port: ?u16 = null, │ │970 - // a host operation requested by a widget. terminals present clone urls on │ │971 + // a host operation requested by a widget. terminals present urls on │ │972 // their restored screen; wasm asks the browser to copy them. │ │973 host_request: ?HostRequest = null, │ │974 quit_requested: bool = false, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────╮ │975 │ │976 pub const HostRequest = union(enum) {│ │976 - clone_url: []const u8, │ │977 + show_url: []const u8, │ │978 }; │ │979 │ │980 const Self = @This(); │ ╰──────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────╮ │1144 if (session.host_request) |request| {│ │1145 session.host_request = null; │ │1146 switch (request) { │ │1146 - .clone_url => |url| { │ │1147 + .show_url => |url| { │ │1148 term.setActive(null); │ │1149 terminal.deinit(io); │ │1150 terminal_live = false; │ ╰───────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │1150 - showCloneUrl(io, url) catch |show_err| { │ │1151 + showUrl(io, url) catch |show_err| { │ │1152 terminal = try term.Terminal.init(io, allocator);│ │1153 terminal_live = true; │ │1154 term.setActive(&terminal); │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────╮ │1185 } │ │1186 } │ │1187 │ │1187 -fn showCloneUrl(io: std.Io, url: []const u8) !void { │ │1188 +fn showUrl(io: std.Io, url: []const u8) !void { │ │1189 const tty: ?std.Io.File = if (builtin.os.tag == .windows)│ │1190 null │ │1191 else │ ╰───────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │2131 grid: ?Grid, │ │2132 session: *Session, │ │2133 arena: std.heap.ArenaAllocator, │ │2134 + url: []const u8 = "", │ │2135 + url_width: usize = 0, │ │2136 │ │2137 pub fn init(allocator: std.mem.Allocator, session: *Session) !Footer {│ │2138 return .{ │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │2156 if (width == 0) return; │ │2157 │ │2158 _ = self.arena.reset(.retain_capacity); │ │2159 + self.url = ""; │ │2160 + self.url_width = 0; │ │2161 const aa = self.arena.allocator(); │ │2162 const path = self.session.data.current_page.toUrl(&self.arena) catch return;│ │2163 const text = if (self.session.web_port) |port| │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │2164 std.fmt.allocPrint(aa, "http://localhost:{d}{s}", .{ port, path }) catch return│ │2165 else │ │2166 path; │ │2167 + self.url = text; │ │2168 │ │2169 var grid = try Grid.init(allocator, .{ .width = width, .height = 1 }); │ │2170 errdefer grid.deinit(); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────╮ │2175 grid.cells.items[try grid.cells.at(.{ 0, i })].rune = ch;│ │2176 i += 1; │ │2177 } │ │2178 + self.url_width = i; │ │2179 self.grid = grid; │ │2180 } │ │2181 │ ╰───────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯