From 9c7962242277b436bba6e53ff048af2eeeeb040f Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Mon, 13 Jul 2026 00:04:31 -0400 Subject: [PATCH] bug: fix draw bug where the pipe chars could draw over the end (#2146) Technically the end could draw over since I did `start..pipe_end`, where `pipe_end` could be equal to `end`. This just caps it at `end - 1`. --- CHANGELOG.md | 3 ++- src/canvas/components/pipe_gauge.rs | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5edc69c..caad414f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,12 +20,13 @@ That said, these are more guidelines rather than hard rules, though the project --- -## Unreleased +## 0.14.5 - Unreleased ### Bug Fixes - [#2144](https://github.com/ClementTsang/bottom/pull/2144): Fix bug with Linux signals 34 or higher being off by 2. - [#2145](https://github.com/ClementTsang/bottom/pull/2145): Fix parsing issue certain comm entries to be missing. +- [#2146](https://github.com/ClementTsang/bottom/pull/2146): Fix draw bug with the pipe gauge in basic mode if the value was 100%. ## 0.14.4 - 2026-07-09 diff --git a/src/canvas/components/pipe_gauge.rs b/src/canvas/components/pipe_gauge.rs index 163bdfb2..5b64ac22 100644 --- a/src/canvas/components/pipe_gauge.rs +++ b/src/canvas/components/pipe_gauge.rs @@ -196,8 +196,10 @@ impl Widget for PipeGauge<'_> { gauge_area.width, ); - let pipe_end = - start + (f64::from(end.saturating_sub(start)) * self.ratio).floor() as u16; + let pipe_end = end.saturating_sub(1).min( + start + (f64::from(end.saturating_sub(start)) * self.ratio).floor() as u16, + ); + for col in start..pipe_end { if let Some(cell) = buf.cell_mut((col, row)) { cell.set_symbol("|").set_style(Style {