Skip to content

Commit

Permalink
Fixed: Scrollbar position incorrect in small lists and selection not …
Browse files Browse the repository at this point in the history
…working when filtering
  • Loading branch information
aristocratos committed Sep 24, 2021
1 parent a35a2c6 commit 2aca963
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/btop_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ namespace Proc {
//* Iteration over processes
int lc = 0;
for (int n=0; auto& p : plist) {
if (n++ < start or p.filtered or (proc_tree and p.tree_index == plist.size())) continue;
if (p.filtered or (proc_tree and p.tree_index == plist.size()) or n++ < start) continue;
bool is_selected = (lc + 1 == selected);
if (is_selected) {
selected_pid = (int)p.pid;
Expand Down Expand Up @@ -1451,7 +1451,7 @@ namespace Proc {

//? Draw scrollbar if needed
if (numpids > select_max) {
const int scroll_pos = clamp((int)round((double)start * (select_max - 2) / (numpids - (select_max - 2))), 0, height - 5);
const int scroll_pos = clamp((int)round((double)start * select_max / (numpids - select_max)), 0, height - 5);
out += Mv::to(y + 1, x + width - 2) + Fx::b + Theme::c("main_fg") + Symbols::up
+ Mv::to(y + height - 2, x + width - 2) + Symbols::down
+ Mv::to(y + 2 + scroll_pos, x + width - 2) + "";
Expand Down

0 comments on commit 2aca963

Please sign in to comment.