Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: fix overflow/underflow with graph timespan zoom #1219

Merged
merged 2 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Bug Fixes

- [https://github.com/ClementTsang/bottom/pull/1216](https://github.com/ClementTsang/bottom/pull/1216): Fix arguments not being sorted alphabetically.
- [#1216](https://github.com/ClementTsang/bottom/pull/1216): Fix arguments not being sorted alphabetically.
- [#1219](https://github.com/ClementTsang/bottom/pull/1219): Fix overflow/underflow in graph timespan zoom.

## [0.9.2] - 2023-06-11

Expand Down
36 changes: 24 additions & 12 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2173,8 +2173,10 @@ impl App {
.widget_states
.get_mut(&self.current_widget.widget_id)
{
let new_time = cpu_widget_state.current_display_time
+ self.app_config_fields.time_interval;
let new_time = cpu_widget_state
.current_display_time
.saturating_add(self.app_config_fields.time_interval);

if new_time <= self.app_config_fields.retention_ms {
cpu_widget_state.current_display_time = new_time;
self.states.cpu_state.force_update = Some(self.current_widget.widget_id);
Expand All @@ -2199,8 +2201,10 @@ impl App {
.widget_states
.get_mut(&self.current_widget.widget_id)
{
let new_time = mem_widget_state.current_display_time
+ self.app_config_fields.time_interval;
let new_time = mem_widget_state
.current_display_time
.saturating_add(self.app_config_fields.time_interval);

if new_time <= self.app_config_fields.retention_ms {
mem_widget_state.current_display_time = new_time;
self.states.mem_state.force_update = Some(self.current_widget.widget_id);
Expand All @@ -2225,8 +2229,10 @@ impl App {
.widget_states
.get_mut(&self.current_widget.widget_id)
{
let new_time = net_widget_state.current_display_time
+ self.app_config_fields.time_interval;
let new_time = net_widget_state
.current_display_time
.saturating_add(self.app_config_fields.time_interval);

if new_time <= self.app_config_fields.retention_ms {
net_widget_state.current_display_time = new_time;
self.states.net_state.force_update = Some(self.current_widget.widget_id);
Expand Down Expand Up @@ -2257,8 +2263,10 @@ impl App {
.widget_states
.get_mut(&self.current_widget.widget_id)
{
let new_time = cpu_widget_state.current_display_time
- self.app_config_fields.time_interval;
let new_time = cpu_widget_state
.current_display_time
.saturating_sub(self.app_config_fields.time_interval);

if new_time >= constants::STALE_MIN_MILLISECONDS {
cpu_widget_state.current_display_time = new_time;
self.states.cpu_state.force_update = Some(self.current_widget.widget_id);
Expand All @@ -2283,8 +2291,10 @@ impl App {
.widget_states
.get_mut(&self.current_widget.widget_id)
{
let new_time = mem_widget_state.current_display_time
- self.app_config_fields.time_interval;
let new_time = mem_widget_state
.current_display_time
.saturating_sub(self.app_config_fields.time_interval);

if new_time >= constants::STALE_MIN_MILLISECONDS {
mem_widget_state.current_display_time = new_time;
self.states.mem_state.force_update = Some(self.current_widget.widget_id);
Expand All @@ -2309,8 +2319,10 @@ impl App {
.widget_states
.get_mut(&self.current_widget.widget_id)
{
let new_time = net_widget_state.current_display_time
- self.app_config_fields.time_interval;
let new_time = net_widget_state
.current_display_time
.saturating_sub(self.app_config_fields.time_interval);

if new_time >= constants::STALE_MIN_MILLISECONDS {
net_widget_state.current_display_time = new_time;
self.states.net_state.force_update = Some(self.current_widget.widget_id);
Expand Down