Skip to content

Commit

Permalink
Merge pull request #714 from tessus/fix/if-name-len
Browse files Browse the repository at this point in the history
  • Loading branch information
aristocratos authored Feb 11, 2024
2 parents edcb68c + 8bf88c1 commit 70dec20
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/btop_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,7 @@ namespace Net {
int x = 1, y, width = 20, height;
int b_x, b_y, b_width, b_height, d_graph_height, u_graph_height;
bool shown = true, redraw = true;
const int MAX_IFNAMSIZ = 15;
string old_ip;
std::unordered_map<string, Draw::Graph> graphs;
string box;
Expand All @@ -1381,7 +1382,7 @@ namespace Net {
out.reserve(width * height);
const string title_left = Theme::c("net_box") + Fx::ub + Symbols::title_left;
const string title_right = Theme::c("net_box") + Fx::ub + Symbols::title_right;
const int i_size = min((int)selected_iface.size(), 10);
const int i_size = min((int)selected_iface.size(), MAX_IFNAMSIZ);
const long long down_max = (net_auto ? safeVal(graph_max, "download"s) : ((long long)(Config::getI("net_download")) << 20) / 8);
const long long up_max = (net_auto ? safeVal(graph_max, "upload"s) : ((long long)(Config::getI("net_upload")) << 20) / 8);

Expand All @@ -1403,7 +1404,7 @@ namespace Net {
//? Interface selector and buttons

out += Mv::to(y, x+width - i_size - 9) + title_left + Fx::b + Theme::c("hi_fg") + "<b " + Theme::c("title")
+ uresize(selected_iface, 10) + Theme::c("hi_fg") + " n>" + title_right
+ uresize(selected_iface, MAX_IFNAMSIZ) + Theme::c("hi_fg") + " n>" + title_right
+ Mv::to(y, x+width - i_size - 15) + title_left + Theme::c("hi_fg") + (safeVal(net.stat, "download"s).offset + safeVal(net.stat, "upload"s).offset > 0 ? Fx::b : "") + 'z'
+ Theme::c("title") + "ero" + title_right;
Input::mouse_mappings["b"] = {y, x+width - i_size - 8, 1, 3};
Expand Down

0 comments on commit 70dec20

Please sign in to comment.