Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Denizantip committed Oct 9, 2024
1 parent 1cae315 commit 58dbbde
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
18 changes: 7 additions & 11 deletions src/btop_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,15 @@ namespace Proc {
}

void _collect_prefixes(tree_proc &t, const bool is_last, const string &header) {
bool is_filtered = t.entry.get().filtered;
if (is_filtered) {
t.entry.get().depth = 0;
}
if (!t.children.empty()) {
t.entry.get().prefix = header + (t.entry.get().collapsed ? "[+]─": "[-]─");
}
else {
t.entry.get().prefix = header + (is_last ? " └─": " ├─");
}
const bool is_filtered = t.entry.get().filtered;
if (is_filtered) t.entry.get().depth = 0;

if (!t.children.empty()) t.entry.get().prefix = header + (t.entry.get().collapsed ? "[+]─": "[-]─");
else t.entry.get().prefix = header + (is_last ? " └─": " ├─");

for (auto child = t.children.begin(); child != t.children.end(); ++child) {
_collect_prefixes(*child, child==(t.children.end() - 1),
(is_filtered ? "": header + (is_last ? " ": "")));
is_filtered ? "": header + (is_last ? " ": ""));
}
}
}
2 changes: 1 addition & 1 deletion src/btop_shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,5 +432,5 @@ namespace Proc {
int cur_depth, bool collapsed, const string& filter,
bool found = false, bool no_update = false, bool should_filter = false);

void _collect_prefixes(tree_proc& t, bool is_last, const string &header);
void _collect_prefixes(tree_proc& t, bool is_last, const string &header = "");
}
2 changes: 1 addition & 1 deletion src/linux/btop_collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2999,7 +2999,7 @@ namespace Proc {
}

for (auto t = tree_procs.begin(); t != tree_procs.end(); ++t) {
_collect_prefixes(*t, t == tree_procs.end() - 1, "");
_collect_prefixes(*t, t == tree_procs.end() - 1);
}

//? Recursive sort over tree structure to account for collapsed processes in the tree
Expand Down

0 comments on commit 58dbbde

Please sign in to comment.