╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Files.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1049 const dir = path[0..slash]; 1050 // the row's border and the label's padding take two columns each 1051 const max_width = View.list_max_width - 4; 1052 var width = try xitui.width.displayWidth(dir); 1053 if (width <= max_width) return std.fmt.allocPrint(aa, " {s} ", .{dir}); 1054 1055 const ellipsis = ".."; 1056 var iter = (try std.unicode.Utf8View.init(dir)).iterator(); 1057 var start: usize = 0; 1058 while (width > max_width - ellipsis.len) { 1059 const slice = iter.nextCodepointSlice() orelse break; 1060 width -= xitui.width.cellWidth(try std.unicode.utf8Decode(slice)); 1061 start += slice.len; 1062 } 1063 return std.fmt.allocPrint(aa, " " ++ ellipsis ++ "{s} ", .{dir[start..]}); 1064 } 1065