mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-10 14:44:18 +00:00
bug: fix overflow/underflow with graph timespan zoom (#1219)
* bug: fix overflow/underflow with graph timespan zoom Basically, you could overflow/underflow the time span which would skip checks. * changelog
This commit is contained in:
parent
76e81df715
commit
6f1a8f7e5b
2 changed files with 26 additions and 13 deletions
|
@ -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
|
||||
|
||||
|
|
36
src/app.rs
36
src/app.rs
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue