fix(tui): refine log selection and filters, label unlinked content
This commit is contained in:
1 parent
8adadf75a8
commit
b5c680ed55
13 files changed
+906
-365
No files matched your search
@@ -352,6 +352,16 @@ pub fn render(
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
let selected_unlinked = mode == ContentMode::Installed
|
||||
&& match tab {
|
||||
ContentTab::Mods => mods_state.selected_is_unlinked(),
|
||||
ContentTab::ResourcePacks => resource_packs_state.selected_is_unlinked(),
|
||||
ContentTab::Shaders => shaders_state.selected_is_unlinked(),
|
||||
ContentTab::Worlds if open_world_datapacks.is_some() => {
|
||||
world_datapacks_state.selected_is_unlinked()
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
|
||||
let kb: Option<&[(&str, &str)]> = if is_focused {
|
||||
Some(match (mode, tab) {
|
||||
@@ -453,9 +463,7 @@ pub fn render(
|
||||
if logs_state.viewer_focused {
|
||||
&[
|
||||
("j/k", " scroll"),
|
||||
("PgUp/PgDn", " page"),
|
||||
("f", " filter"),
|
||||
("y", " copy"),
|
||||
("g/G", " top/bottom"),
|
||||
("d", " delete"),
|
||||
("Esc", " back"),
|
||||
@@ -495,6 +503,13 @@ pub fn render(
|
||||
};
|
||||
|
||||
let mut keybinds = kb.map_or_else(Vec::new, <[_]>::to_vec);
|
||||
if is_focused
|
||||
&& mode == ContentMode::Installed
|
||||
&& tab == ContentTab::Logs
|
||||
&& logs_state.selection.range.is_some()
|
||||
{
|
||||
keybinds.insert(0, ("y", " yank"));
|
||||
}
|
||||
if is_focused
|
||||
&& (mode == ContentMode::Installed || (!discovery_page_open && !discovery_unavailable))
|
||||
&& (matches!(
|
||||
@@ -536,8 +551,20 @@ pub fn render(
|
||||
area.width.saturating_sub(2),
|
||||
));
|
||||
|
||||
let content_area = block.inner(area);
|
||||
let mut content_area = block.inner(area);
|
||||
frame.render_widget(block, area);
|
||||
if is_focused && selected_unlinked && content_area.height > 1 {
|
||||
content_area.height -= 1;
|
||||
frame.render_widget(
|
||||
Paragraph::new(" No online source linked; version switching unavailable.")
|
||||
.style(Style::default().fg(theme.text_dim())),
|
||||
Rect {
|
||||
y: content_area.bottom(),
|
||||
height: 1,
|
||||
..content_area
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
let downloadable_state = match tab {
|
||||
ContentTab::Mods => Some((mods_state, mods_discovery_state)),
|
||||
|
||||
Reference in new issue
Block a user