function ui::activity::service_row() { local dest_display="${1:-}" drop_count="${2:-0}" drop_word="${3:-drops}" \ drops_col="${4:-30}" w_drops="${5:-1}" # Align drop count with peer drop column # Service row visible prefix: " → " (6 visible) + ${#dest_display} # But "→" is 3 bytes, 1 visible — arrow_prefix bytes = 8, visible = 6 local arrow_prefix=" → " local prefix_bytes=${#arrow_prefix} # 8 bytes due to → being 3 bytes local prefix_len=$(( prefix_bytes + ${#dest_display} )) local pad_n=$(( drops_col - prefix_len )) [[ $pad_n -lt 1 ]] && pad_n=1 printf " \033[2m→\033[0m %s%*s %${w_drops}s %s\n" \ "$dest_display" "$pad_n" "" "$drop_count" "$drop_word" } function ui::activity::accept_dest_row() { local dest="${1:-}" bytes_raw="${2:-0}" bytes_fmt="${3:-}" \ count="${4:-0}" drops_col="${5:-40}" w_drops="${6:-4}" local conn_word="conns" [[ "$count" -eq 1 ]] && conn_word="conn" local arrow_prefix=" → " # Pad dest to align count at drops_col # arrow_prefix visible length = 6, → = 3 bytes so prefix_bytes = 8 local prefix_visible=6 local dest_width=$(( drops_col - 5 - w_drops )) [[ $dest_width -lt 0 ]] && dest_width=28 printf "%s\033[0;32m%-${dest_width}s %4s %-5s %-8s\033[0m\n" \ "$arrow_prefix" "$dest" "$count" "$conn_word" "$bytes_fmt" }