Skip to content

Commit 39f8ebe

Browse files
authored
fix: properly highlight down arrow if it's actionable (aristocratos#1462)
Closes: aristocratos#1461
1 parent 2e41e76 commit 39f8ebe

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/btop_draw.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,7 @@ namespace Proc {
15481548
int x, y, width = 20, height;
15491549
int start, selected, select_max;
15501550
bool shown = true, redraw = true;
1551+
bool is_last_process_in_list = false;
15511552
int selected_pid = 0, selected_depth = 0;
15521553
int scroll_pos;
15531554
string selected_name;
@@ -1694,6 +1695,18 @@ namespace Proc {
16941695
}
16951696
}
16961697

1698+
//? redraw if selection reaches or leaves the end of the list
1699+
if (selected != Config::getI("proc_last_selected")) {
1700+
if (selected >= select_max and start >= numpids - select_max) {
1701+
redraw = true;
1702+
is_last_process_in_list = true;
1703+
}
1704+
else if (is_last_process_in_list) {
1705+
redraw = true;
1706+
is_last_process_in_list = false;
1707+
}
1708+
}
1709+
16971710
//* Redraw elements not needed to be updated every cycle
16981711
if (redraw) {
16991712
out = box;
@@ -1846,7 +1859,7 @@ namespace Proc {
18461859
Input::mouse_mappings["right"] = {y, sort_pos + sort_len + 3, 1, 2};
18471860

18481861
//? select, info, signal, and follow buttons
1849-
const string down_button = (selected == select_max and start == numpids - select_max ? Theme::c("inactive_fg") : Theme::c("hi_fg")) + Symbols::down;
1862+
const string down_button = (is_last_process_in_list ? Theme::c("inactive_fg") : Theme::c("hi_fg")) + Symbols::down;
18501863
const string t_color = (selected == 0 ? Theme::c("inactive_fg") : Theme::c("title"));
18511864
const string hi_color = (selected == 0 ? Theme::c("inactive_fg") : Theme::c("hi_fg"));
18521865
int mouse_x = x + 14;

0 commit comments

Comments
 (0)