╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Threads.zig ──────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2158 const cid = inner.getFocus().child_id orelse return false; 2159 return inner.children.getIndex(cid) == tags_child_index and self.tagFlow(index) != null; 2160 } 2161 2162 fn toolRowFocused(self: *This, index: usize) bool { 2163 const outer = self.detailOuter(index); 2164 const cid = outer.getFocus().child_id orelse return false; 2165 return outer.children.getIndex(cid) == tool_row_index; 2166 } 2167 2168 fn focusTag(self: *This, index: usize, tf: *ui.TagFlow, root_focus: *Focus, item: usize) void { 2169 root_focus.setFocus(tf.text_boxes.items[item].getFocus().id); 2170 // keep the tag visible on the terminal: its rect offset by the flow's 2171 // position in the pane. 2172 if (self.session.is_terminal and item < tf.rects.items.len) { 2173 if (self.detailInner(index).children.values()[tags_child_index].rect) |flow_rect| { 2174 var rect = tf.rects.items[item]; 2175 rect.x += flow_rect.x; 2176 rect.y += flow_rect.y; 2177 self.detailScroll(index).scrollToRect(rect); 2178 } 2179 } 2180 } 2181 2182 fn titleFocused(self: *This, index: usize) bool { 2183 const inner = self.detailInner(index); 2184 const cid = inner.getFocus().child_id orelse return false; 2185 return inner.children.getIndex(cid) == title_child_index; 2186 } 2187 2188 fn authorFocused(self: *This, index: usize) bool { 2189 const inner = self.detailInner(index); 2190 const cid = inner.getFocus().child_id orelse return false; 2191 return cid == self.author_id[index]; 2192 } 2193 2194 fn descriptionFocused(self: *This, index: usize) bool { 2195 const cid = self.detailInner(index).getFocus().child_id orelse return false; 2196 return cid == self.description_id[index]; 2197 } 2198 2199 // return to the tool row's last-focused button (the header when the 2200 // description page shows no row). 2201 fn focusToolRow(self: *This, index: usize, root_focus: *Focus) void { 2202 const cid = self.toolRow(index).getFocus().child_id orelse return self.focusHeader(root_focus); 2203 root_focus.setFocus(cid); 2204 } 2205 2206 // enter the detail pane. an empty pane (no issues) can't be entered. 2207 fn focusDetail(self: *This, index: usize, root_focus: *Focus) !void { 2208 if (self.detailInner(index).children.count() == 0) return; 2209 root_focus.setFocus(self.detailOuter(index).getFocus().id); 2210 } 2211 2212 // return to the list. 2213 fn focusList(self: *This, index: usize, root_focus: *Focus) !void { 2214 root_focus.setFocus(self.listScroll(index).getFocus().id); 2215 } 2216 2217 // cross to the header tabs above the stack. 2218 fn focusHeader(self: *This, root_focus: *Focus) void { 2219 root_focus.setFocus(self.box.children.keys()[header_index]); 2220 } 2221 2222 pub fn clearGrid(self: *This) void { 2223 self.box.clearGrid(); 2224 } 2225 2226 pub fn getGrid(self: This) ?Grid { 2227 return self.box.getGrid(); 2228 } 2229 2230 pub fn getFocus(self: *This) *Focus { 2231 return self.box.getFocus(); 2232 } 2233 2234 // for the parent's "scroll up at the top jumps to the header" check: at the 2235 // top only while the header tabs hold focus, so up from the split 2236 // crosses into the tabs first. 2237 pub fn getSelectedIndex(self: *This) ?usize { 2238 return if (self.headerActive()) 0 else 1; 2239 } 2240 }; 2241 } 2242